我在npm install -g express generator install之后收到以下消息。我已经尝试了所有我知道如何解决这个问题。有没有其他方法让我安装它而不会收到此错误消息?
npm ERR! System Darwin 13.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "express" "generator"
npm ERR! cwd /Users/abdulaleemseyed
npm ERR! node -v v0.10.30
npm ERR! npm -v 1.4.21
npm ERR! path /usr/local/lib/node_modules/generator
npm ERR! fstream_path /usr/local/lib/node_modules/generator
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/generator'
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/abdulaleemseyed/npm-debug.log
npm ERR! not ok code 0
Abdulaleems-MacBook-Pro:~ abdulaleemseyed$
答案 0 :(得分:1)
在npm install之前使用sudo
。因为在全局安装时必须授予写入/ usr / lib /的权限。
所以请使用sudo npm install express-generator -g
。