npm install 老是報錯(Mac OS環境下)

mac使用npm安裝hexo,輸入命令:node

報錯以下:npm install -g hexo-cli

npm ERR! Darwin 14.5.0sql

npm ERR! argv "/Users/wangmaster/.nvm/versions/node/v4.4.2/bin/node" "/Users/wangmaster/.nvm/versions/node/v4.4.2/bin/npm" "install" "-g" "hexo-cli"npm

npm ERR! node v4.4.2hexo

npm ERR! npm  v2.15.0this

npm ERR! path /Users/wangmaster/.nvm/versions/node/v4.4.2/lib/node_modules/hexo-cli/.editorconfigspa

npm ERR! code EACCESdebug

npm ERR! errno -13code

npm ERR! syscall unlinkit

 

npm ERR! Error: EACCES: permission denied, unlink '/Users/wangmaster/.nvm/versions/node/v4.4.2/lib/node_modules/hexo-cli/.editorconfig'io

npm ERR!     at Error (native)

npm ERR!  { [Error: EACCES: permission denied, unlink '/Users/wangmaster/.nvm/versions/node/v4.4.2/lib/node_modules/hexo-cli/.editorconfig']

npm ERR!   errno: -13,

npm ERR!   code: 'EACCES',

npm ERR!   syscall: 'unlink',

npm ERR!   path: '/Users/wangmaster/.nvm/versions/node/v4.4.2/lib/node_modules/hexo-cli/.editorconfig' }

npm ERR! 

npm ERR! Please try running this command again as root/Administrator.

npm ERR! error rolling back Error: EACCES: permission denied, unlink '/Users/wangmaster/.nvm/versions/node/v4.4.2/lib/node_modules/hexo-cli/.editorconfig'

npm ERR! error rolling back     at Error (native)

npm ERR! error rolling back  { [Error: EACCES: permission denied, unlink '/Users/wangmaster/.nvm/versions/node/v4.4.2/lib/node_modules/hexo-cli/.editorconfig']

npm ERR! error rolling back   errno: -13,

npm ERR! error rolling back   code: 'EACCES',

npm ERR! error rolling back   syscall: 'unlink',

npm ERR! error rolling back   path: '/Users/wangmaster/.nvm/versions/node/v4.4.2/lib/node_modules/hexo-cli/.editorconfig' }

 

npm ERR! Please include the following file with any support request:

npm ERR!     /Users/wangmaster/Desktop/Blog/npm-debug.log

 

解決方案:

  - 加上sudo執行:

即:

sudo npm install -g hexo-cli按回車,輸入機器密碼便可。
相關文章
相關標籤/搜索