Closed GanZhiXiong closed 2 years ago
搜索得知,是因为从 fork 仓库安装的 hexo-component-inferno 不包含 build 后的文件导致的。 于是执行如下步骤:
对 fork 的仓库,创建一个带有 build 后的文件的分支。
$ git checkout -b useLocally
Switched to a new branch 'useLocally'
注释 .gitignore 文件中从 build 输出的文件夹 lib。
推送到远程分支。
使用如下命令安装带有 build 输出文件夹的分支。
npm install --save hexo-component-inferno@github:ganzhixiong/hexo-component-inferno#useLocally
执行 hexo g
报了一个和之前不一样的错误:
$ hexo g
INFO Validating config
Inferno is in development mode.
INFO =======================================
██╗ ██████╗ █████╗ ██████╗ ██╗ ██╗███████╗
██║██╔════╝██╔══██╗██╔══██╗██║ ██║██╔════╝
██║██║ ███████║██████╔╝██║ ██║███████╗
██║██║ ██╔══██║██╔══██╗██║ ██║╚════██║
██║╚██████╗██║ ██║██║ ██║╚██████╔╝███████║
╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝
=============================================
INFO === Checking package dependencies ===
ERROR Package hexo-component-inferno's version (1.1.0) does not satisfy the required version (github:ganzhixiong/hexo-component-inferno#useLocally).
ERROR Please install the missing dependencies your Hexo site root directory:
ERROR npm install --save hexo-component-inferno@github:ganzhixiong/hexo-component-inferno#useLocally
ERROR or:
ERROR yarn add hexo-component-inferno@github:ganzhixiong/hexo-component-inferno#useLocally
@ppoffice 有劳大神有空看看哈,非常感谢。
不要在icarus目录下安装,在博客根目录安装试试。或者你fork的仓库新建一个版本号tag,npm安装那个tag而不是useLocal。
在博客根目录安装还是一样的。稍后我将尝试安装 fork 的 tag 版本。
# gan @ ganzhixiongdeMac-Studio in ~/Documents/blog on git:master x [20:23:50]
$ npm install --save hexo-component-inferno@github:ganzhixiong/hexo-component-inferno#useLocally
added 2 packages in 35s
29 packages are looking for funding
run `npm fund` for details
# gan @ ganzhixiongdeMac-Studio in ~/Documents/blog on git:master x [20:25:05]
$ hexo g
INFO Validating config
Inferno is in development mode.
INFO =======================================
██╗ ██████╗ █████╗ ██████╗ ██╗ ██╗███████╗
██║██╔════╝██╔══██╗██╔══██╗██║ ██║██╔════╝
██║██║ ███████║██████╔╝██║ ██║███████╗
██║██║ ██╔══██║██╔══██╗██║ ██║╚════██║
██║╚██████╗██║ ██║██║ ██║╚██████╔╝███████║
╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝
=============================================
INFO === Checking package dependencies ===
ERROR Package hexo-component-inferno's version (1.1.0) does not satisfy the required version (github:ganzhixiong/hexo-component-inferno#useLocally).
ERROR Please install the missing dependencies your Hexo site root directory:
ERROR npm install --save hexo-component-inferno@github:ganzhixiong/hexo-component-inferno#useLocally
ERROR or:
ERROR yarn add hexo-component-inferno@github:ganzhixiong/hexo-component-inferno#useLocally
新建了一个 tag 1.1.1 ,从 tag 版本安装也是一样的:
# gan @ ganzhixiongdeMac-Studio in ~/Documents/blog on git:master x [20:44:28]
$ npm install --save hexo-component-inferno@github:ganzhixiong/hexo-component-inferno#1.1.1
added 2 packages in 31s
29 packages are looking for funding
run `npm fund` for details
# gan @ ganzhixiongdeMac-Studio in ~/Documents/blog on git:master x [20:45:04]
$ hexo g
INFO Validating config
Inferno is in development mode.
INFO =======================================
██╗ ██████╗ █████╗ ██████╗ ██╗ ██╗███████╗
██║██╔════╝██╔══██╗██╔══██╗██║ ██║██╔════╝
██║██║ ███████║██████╔╝██║ ██║███████╗
██║██║ ██╔══██║██╔══██╗██║ ██║╚════██║
██║╚██████╗██║ ██║██║ ██║╚██████╔╝███████║
╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝
=============================================
INFO === Checking package dependencies ===
ERROR Package hexo-component-inferno's version (1.1.0) does not satisfy the required version (github:ganzhixiong/hexo-component-inferno#useLocally).
ERROR Please install the missing dependencies your Hexo site root directory:
ERROR npm install --save hexo-component-inferno@github:ganzhixiong/hexo-component-inferno#useLocally
ERROR or:
ERROR yarn add hexo-component-inferno@github:ganzhixiong/hexo-component-inferno#useLocally
你icarus主题的package.json是怎样的?不行的话把scripts/index.js里面检查dependency 的那行注释掉就行了。
果然注释掉 themes/icarus/scripts/index.js 下的 检查 dependency 就好了。
/**
* Check if all dependencies are installed
*/
// require('../include/dependency')(hexo);
但是有一个错误提示
$ hexo s
INFO Validating config
Inferno is in development mode.
ERROR {
err: [Error: EISDIR: illegal operation on a directory, read] {
errno: -21,
code: 'EISDIR',
syscall: 'read'
}
} Plugin load failed: %s hexo-component-inferno
INFO =======================================
██╗ ██████╗ █████╗ ██████╗ ██╗ ██╗███████╗
██║██╔════╝██╔══██╗██╔══██╗██║ ██║██╔════╝
██║██║ ███████║██████╔╝██║ ██║███████╗
██║██║ ██╔══██║██╔══██╗██║ ██║╚════██║
██║╚██████╗██║ ██║██║ ██║╚██████╔╝███████║
╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝
=============================================
INFO === Checking theme configurations ===
INFO === Registering Hexo extensions ===
"hexo-component-inferno": "github:ganzhixiong/hexo-component-inferno#useLocally",
你把这行改回去,然后npm install的时候别--save
就不会检查错误了。
你把这行改回去
改成什么啊? 改成"^1.1.0"吗?还是什么?
解决从 fork 仓库安装 hexo-component-inferno 报错 ERROR Package hexo-component-inferno's version (1.1.0) does not satisfy the required version (github:ganzhixiong/hexo-component-inferno#useLocally).
的问题。
经过多次尝试,在博客根目录或主题根目录安装 fork 仓库的 hexo-component-inferno 都没有问题了。
先卸载主题的 hexo-component-inferno 依赖包。
一定要卸载主题下的此依赖包,因为主题下的依赖包优先级大于其他目录。
# gan @ ganzhixiongdeMac-Studio in ~/Documents/blog/themes/icarus on git:master x [10:20:41]
$ npm uninstall hexo-component-inferno
到博客的根目录下安装 fork 仓库的 hexo-component-inferno。
# gan @ ganzhixiongdeMac-Studio in ~/Documents/blog on git:master x [10:26:28] C:1
$ npm install ganzhixiong/hexo-component-inferno#useLocally
到主题的根目录下安装 fork 仓库的 hexo-component-inferno。
# gan @ ganzhixiongdeMac-Studio in ~/Documents/blog/themes/icarus on git:master x [10:33:28]
$ npm install ganzhixiong/hexo-component-inferno#useLocally --save
执行 hexo s
或 hexo g
都会报错:
# gan @ ganzhixiongdeMac-Studio in ~/Documents/blog on git:master x [11:15:05] C:255
$ hexo s
INFO Validating config
Inferno is in development mode.
INFO =======================================
██╗ ██████╗ █████╗ ██████╗ ██╗ ██╗███████╗
██║██╔════╝██╔══██╗██╔══██╗██║ ██║██╔════╝
██║██║ ███████║██████╔╝██║ ██║███████╗
██║██║ ██╔══██║██╔══██╗██║ ██║╚════██║
██║╚██████╗██║ ██║██║ ██║╚██████╔╝███████║
╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝
=============================================
INFO === Checking package dependencies ===
ERROR Package hexo-component-inferno's version (1.1.2) does not satisfy the required version (github:ganzhixiong/hexo-component-inferno#useLocally).
ERROR Please install the missing dependencies your Hexo site root directory:
ERROR npm install --save hexo-component-inferno@github:ganzhixiong/hexo-component-inferno#useLocally
ERROR or:
ERROR yarn add hexo-component-inferno@github:ganzhixiong/hexo-component-inferno#useLocally
注释掉 themes/icarus/scripts/index.js 下的 检查 dependency,即可解决。
/**
* Check if all dependencies are installed
*/
// require('../include/dependency')(hexo);
问题描述
因为我想改些代码,所以先 fork 这个仓库,然后在我的博客 icarus 主题下安装我 fork 的这个仓库,执行
hexo g
报错Error: EISDIR: illegal operation on a directory, read
。复现步骤
changed 1 package in 43s
75 packages are looking for funding run
npm fund
for details