Hexo: mac 安装 hexo 碰到问题 怎么解决

Created on 14 Aug 2016  ·  4Comments  ·  Source: hexojs/hexo

$ npm install hexo -g
npm ERR! tar.unpack untar error /Users/yundousanle/.npm/hexo/3.2.2/package.tgz
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "hexo" "-g"
npm ERR! node v4.4.7
npm ERR! npm v2.15.8
npm ERR! path /usr/local/lib/node_modules/hexo
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir

npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/hexo'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/hexo']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/hexo',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/hexo',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:35:25',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:47:53',
npm ERR! 'FSReqWrap.oncomplete (fs.js:82:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/yundousanle/npm-debug.log

Most helpful comment

前面添加 sudo

All 4 comments

permission denied

还有,看网上的教程请注意一下更新时间,以官方文档为准。
现在安装命令已经修改为npm install hexo-cli -g了。

Permission denied 的问题 怎么操作解决?

前面添加 sudo

我也遇到了这个问题,然后在网上查了好久,给的建议都是加sudo,但使用sudo会造成不可预知的问题,所以不要轻易使用。使用nvm管理npm,或者更改npm的默认安装文件夹就可以解决权限问题,而不需要用到sudo,详细见https://longxiezju.top/2018/04/16/npm_permission/

Was this page helpful?
0 / 5 - 0 ratings