Enjoy the good life everyday!
关闭
欢迎来PyGo个人空间 ^_^
Hexo-环境搭建之node版本问题 | PyGo²

Hexo-环境搭建之node版本问题

背景

昨天买了个腾讯云服务器 + 域名,于是把自己的blog迁移云服务上,就得搭建nodejs、npm、hexo等运行环境。但是环境都装好了,一运行hexo居然报错了,错的内容在正文。

既然出现错误,解决就好了。


错误内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
usr/lib/node_modules/hexo-cli/node_modules/chokidar/index.js:150
async remove(item) {
^^^^^^


SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/lib/node_modules/hexo-cli/node_modules/hexo-fs/lib/fs.js:6:18)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)

上述的错误搜索了好半天才没有到找到一个解决办法,不过在失去希望的时候,发了在baidu论坛有个人跟我报了一样的错误,而且还解决了,不买官司了,原因是:node版本过低

解决办法

升级nodejs即可,具体操作如下:

1
2
3
4
5
6
7
8
9
10
npm install -g n

# 升级到最新稳定版本:
n stable

# 升级到最新版本:
n latest

# 升级到指定版本:
n 0.10.26

学习参考

n:https://www.jianshu.com/p/a2ee8f61a8ca
帖子:https://tieba.baidu.com/p/6311927039?red_tag=1232994946

  • 本文作者:mingliang.gao【一个爱老婆Python程序猿。。。。。。】
  • 本文链接: http://pygo2.top/articles/10512/
  • 版权声明: 本博客所有文章欢迎转载,转载请注明出处!
觉得有帮助 请偶坐个公交车
0%