Mac 安装 hexo

想把博客从jekyll迁移到hexo,但是在安装hexo的时候遇到了如下问题,这怎么解决,有知道的谢谢能分享我一下

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hexo-util@0.6.0 build:highlight: `node scripts/build_highlight_alias.js > highlight_alias.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hexo-util@0.6.0 build:highlight script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

┌──────────────────────────────────────────────────────────────────┐
│                     npm update check failed                      │
│               Try running with sudo or get access                │
│               to the local update config store via               │
│ sudo chown -R $USER:$(id -gn $USER) /Users/yangxiangming/.config │
└──────────────────────────────────────────────────────────────────┘
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: dtrace-provider@0.8.3 (node_modules/hexo-cli/node_modules/dtrace-provider):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: dtrace-provider@0.8.3 install: `node scripts/install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hexo-util@0.6.0 postinstall: `npm run build:highlight`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hexo-util@0.6.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/yangxiangming/.npm/_logs/2017-06-18T03_02_00_507Z-debug.log
阅读 7.1k
7 个回答

你的网络环境不好,请在终端启用代理

比如SS的终端代理: export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;

网络问题,终端走代理是可行的,但是稳定的网络更关键,你拿手机4G开个热点,妥妥的

如果你是直接把目录拷过去的话,需要删除掉 package.json 然后重新安装的。

谢谢各位的积极回答,试了各位提供的方法建议,还是没能解决我的问题。我实在没办法就把node.js给卸载掉,重新安装了node.js,然后重新执行hexo安装命令就可以了。虽然解决了问题,但是没找到原因,表示非常失败。各位有遇到同样问题的,可以尝试重装node.js

一开始我是用

 sudo npm install hexo -g

报这个错
后来我直接 npm install hexo -g 就安装成功了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进