Closed BingzhaoChen closed 2 weeks ago
Thanks for opening this issue, maintainers will get back to you as soon as possible!
你好,是按照文档上的步骤初始化仓库的吗?我刚刚又尝试了一下,没有报错。步骤如下
hexo init blog
cd blog
npm install --save hexo-theme-next
然后在 _config.yml
中修改 theme: next
,再 hexo s
,能正常使用。
你好,是按照文档上的步骤初始化仓库的吗?我刚刚又尝试了一下,没有报错。步骤如下
hexo init blog cd blog npm install --save hexo-theme-next
然后在
_config.yml
中修改theme: next
,再hexo s
,能正常使用。
对的。 使用hexo默认的主题已经成功运行了。 但是只要我用next就报错
默认配置是正常运行的。
我换成 icarus也是正常的
报错代码位于:
这个@adobe/css-tools
好像不是项目的直接依赖?间接依赖是有风险的
报错代码位于:
这个
@adobe/css-tools
好像不是项目的直接依赖?间接依赖是有风险的
我之前唯一一次遇到这个错误,是卸载 hexo-renderer-stylus
造成的。@adobe/css-tools
是这个插件的依赖,NexT 默认它存在:
hexo-site@0.0.0 /Users/sghuang/dev/test
└─┬ hexo-renderer-stylus@3.0.1
└─┬ stylus@0.62.0
└── @adobe/css-tools@4.3.3
猜测这位用户是 Node 环境里出了什么问题,导致 Next 没有加载到 @adobe/css-tools
,
我之前提议过把 hexo-renderer-stylus
加入 peer dependencies,现在看来最好的做法应该是我们直接把 CSS 放进 NexT 的依赖。然后删掉这个 try catch block。
在删除掉 hexo-renderer-stylus
的情况下,只安装 css / @adobe/css-tools 依然无法正常渲染。
感觉最稳妥的做法是,把 hexo-renderer-stylus
和 css
或者 @adobe/css-tools
都加入依赖。
https://www.npmjs.com/package/css
https://www.npmjs.com/package/@adobe/css-tools
目前 css-tools 的下载量差不多是两倍于 css,并且还有维护,但是体积也大不少
Node.js and NPM Information
$ node -v && npm -v v12.22.12 6.14.16
@BingzhaoChen 您的 Node 和 NPM 的版本都太低了。目前 Node 最新版本已经是 v22.6.0,NPM 最新版本已经是 v10.8.2。升级之后应该能解决问题。
Node.js and NPM Information
$ node -v && npm -v v12.22.12 6.14.16
@BingzhaoChen 您的 Node 和 NPM 的版本都太低了。目前 Node 最新版本已经是 v22.6.0,NPM 最新版本已经是 v10.8.2。升级之后应该能解决问题。
升级到最新的node后可以了
目前的主要问题是Hexo提供两种安装主题的方式:git clone
或者npm i
,即使主题把这些库显式加入依赖了,通过git clone
安装主题的话还是不会安装上,所以干脆就没有管了…
这样确实是有风险的,我们可以在未来研究更规范的安装方法(例如检测到用户是通过git clone
安装的主题,并且缺失依赖,就通过npm
安装依赖包)
Issue Checklist
Expected behavior
正常运行
Actual behavior
all new project
Steps to reproduce the behavior
新创建的hexo 和 Next。 运行 hexo g -d 报错
Node.js and NPM Information
Package dependencies Information
Hexo Configuration
NexT Configuration
Other Information
chrome; windows 10;