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 ()
    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:第四步遇到了错误,错误提示如下:

> [email protected] 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

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

你可能感兴趣的:(Hexo版本升级指南)