hexo博客站点通过Appveyor持续集成问题记录
目前hexo博客放在了Appveyor平台做持续集成,每次只需要把改动的文件提交到github上即可自动触发持续集成,从而更新github上的xx.github.io仓库的文件。
主要是参考以下博客进行搭建:https://www.jianshu.com/p/60de63b14ae5?from=jiantop.com
问题:由于参考的是博主博客贴出的默认配置,当时搭建好也是可以正常使用。
当时hexo-cli客户端版本:3.1.0
appveyor.yml
...略 install: - node --version - npm --version - npm install - npm install hexo-cli -g //每次执行都会安装最新版本的hexo-cli客户端 ...略
但随着时间推移,hexo-cli客户端的版本也在不断更新,2020-10-15更新时,会报如下错误。
Build started git clone -q --depth=5 --branch=dependabot/npm_and_yarn/themes/yilia/node-sass-4.14.1 https://github.com/shandianlala/hexo-blog.git C:\projects\hexo-blog git checkout -qf 8b93d2a5ab3c5d7198a12d91ab73ab9d64a85ac0 Running Install scripts node --version v8.17.0 npm --version 6.13.4 npm install npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"}) added 3 packages from 8 contributors and audited 345 packages in 3.128s found 102 vulnerabilities (52 low, 19 moderate, 29 high, 2 critical) run `npm audit fix` to fix them, or `npm audit` for details npm install hexo-cli -g C:\Users\appveyor\AppData\Roaming\npm\hexo -> C:\Users\appveyor\AppData\Roaming\npm\node_modules\hexo-cli\bin\hexo npm WARN notsup Unsupported engine for hexo-cli@4.2.0: wanted: {"node":">=10.13.0"} (current: {"node":"8.17.0","npm":"6.13.4"}) npm WARN notsup Not compatible with your version of node/npm: hexo-cli@4.2.0 npm WARN notsup Unsupported engine for chalk@4.1.0: wanted: {"node":">=10"} (current: {"node":"8.17.0","npm":"6.13.4"}) npm WARN notsup Not compatible with your version of node/npm: chalk@4.1.0 npm WARN notsup Unsupported engine for hexo-log@2.0.0: wanted: {"node":">=10.13.0"} (current: {"node":"8.17.0","npm":"6.13.4"}) npm WARN notsup Not compatible with your version of node/npm: hexo-log@2.0.0 npm WARN notsup Unsupported engine for hexo-fs@3.1.0: wanted: {"node":">=10.13.0"} (current: {"node":"8.17.0","npm":"6.13.4"}) npm WARN notsup Not compatible with your version of node/npm: hexo-fs@3.1.0 npm WARN notsup Unsupported engine for hexo-util@2.4.0: wanted: {"node":">=10.13.0"} (current: {"node":"8.17.0","npm":"6.13.4"}) npm WARN notsup Not compatible with your version of node/npm: hexo-util@2.4.0 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\hexo-cli\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"}) + hexo-cli@4.2.0 added 61 packages from 315 contributors in 4.914s hexo generate console.js:35 throw new TypeError('Console expects a writable stream instance'); ^ TypeError: Console expects a writable stream instance at new Console (console.js:35:11) at Object.<anonymous> (C:\Users\appveyor\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\hexo-log\lib\log.js:31:17) at Module._compile (module.js:653:30) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12) at Function.Module._load (module.js:498:3) at Module.require (module.js:597:17) at require (internal/module.js:11:18) at Object.<anonymous> (C:\Users\appveyor\AppData\Roaming\npm\node_modules\hexo-cli\lib\context.js:3:16) at Module._compile (module.js:653:30) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12) at Function.Module._load (module.js:498:3) at Module.require (module.js:597:17) Command exited with code 1
此时hexo-cli客户端版本:4.2.0 ,依赖node版本:10.13.0及以上。
npm WARN notsup Unsupported engine for hexo-cli@4.2.0: wanted: {"node":">=10.13.0"} (current: {"node":"8.17.0","npm":"6.13.4"})
此时问题原因找到了,现在有两种办法解决该问题
- 将hexo-cli的版本降级到: 3.1.0
- 将node的版本升级到:10.13.0及以上。
我使用了第一种方式,因为第二种方式还需要去调研下Appveyor是否支持让你去更改它提供的node软件版本,需要花时间。
更改如下文件:appveyor.yml
...略
install:
- node --version
- npm --version
- npm install
- npm install hexo-cli@3.1.0 -g //每次执行都会强制安装指定版本的hexo-cli客户端
...略
至此,本次排查结束,问题解决。