Hexo版本升级指南

前言

更换了新主题,在hexo g和hexo s的时候总会报如下错误,在主题github issues逛了一圈后,感觉应该是我的hexo版本太老了。

➜ hexo s
(node:64285) [DEP0061] DeprecationWarning: fs.SyncWriteStream is deprecated.
INFO  Start processing
ERROR Process failed: layout/archive.ejs
SyntaxError: Invalid or unexpected token in "/Users/lanvnal/Files/blog/themes/hexo-theme-matery/layout/archive.ejs"
    at new Function (<anonymous>)
    at Object.exports.compile (/Users/lanvnal/Files/blog/node_modules/ejs/lib/ejs.js:242:14)
    at Function.ejsRenderer.compile (/Users/lanvnal/Files/blog/node_modules/hexo-renderer-ejs/lib/renderer.js:11:14)
    at Theme._View.View.View._precompile (/Users/lanvnal/Files/blog/node_modules/hexo/lib/theme/view.js:117:31)

决定升级hexo版本,但是没找到很明确的升级hexo的文章,遂做一下记录。

升级

1、全局升级hexo-cli,先hexo version查看当前版本,然后npm i hexo-cli -g,再次hexo version查看是否升级成功。

2、使用npm install -g npm-checknpm-check,检查系统中的插件是否有升级的,可以看到自己前面都安装了那些插件

3、使用npm install -g npm-upgradenpm-upgrade,升级系统中的插件

4、使用npm update -gnpm update --save

PS:第四步遇到了错误,错误提示如下:

> fsevents@1.2.11 install /Users/lanvnal/Files/blog/node_modules/hexo/node_modules/fsevents
> node-gyp rebuild

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
gyp: No Xcode or CLT version detected!

其实已经安装过了xcode cli,但是这里还是报错了,估计和苹果新系统有关,重装就好了,操作如下:

如果像以前一样执行xcode-select --install会有如下报错:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

解决办法:

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

然后再执行第四步,完美升级。

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值