2014-12-07 63 views
0

我正在用Yeoman生成器設置Meanjs實例。當我做'sudo yo meanjs'時,一切都很好,直到它看起來正在嘗試創建一個目錄並且失敗,對這裏發生的事情有任何想法?Yeoman Javascript錯誤涉及'mkdir'

SOLINK_MODULE(target) Release/kerberos.node: Finished 

> [email protected] install /Users/xxx/Documents/mean/node_modules/connect- 
    mongo/node_modules/mongodb/node_modules/bson 
> (node-gyp rebuild 2> builderror.log) || (exit 0) 

    CXX(target) Release/obj.target/bson/ext/bson.o 
    SOLINK_MODULE(target) Release/bson.node 
    SOLINK_MODULE(target) Release/bson.node: Finished 
npm ERR! Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15' 
npm ERR! { [Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15'] 
npm ERR! errno: 3, 
npm ERR! code: 'EACCES', 
npm ERR! path: '/Users/xxx/.npm/uglify-js/2.4.15', 
npm ERR! parent: 'grunt-contrib-uglify' } 
npm ERR! 
npm ERR! Please try running this command again as root/Administrator. 

npm ERR! System Darwin 13.4.0 
npm ERR! command "node" "/usr/local/bin/npm" "install" 
npm ERR! cwd /Users/xxx/Documents/mean 
npm ERR! node -v v0.10.33 
npm ERR! npm -v 1.4.28 
npm ERR! path /Users/xxx/.npm/uglify-js/2.4.15 
npm ERR! code EACCES 
npm ERR! errno 3 
npm ERR! stack Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15' 
npm ERR! not ok code 0 

回答

1

這是一個很常見的錯誤。

約曼運行以下:

bower install & npm install 

鮑爾安裝成功,但是NPM安裝,因爲用戶權限的失敗。只要運行:

sudo npm install 
1

的ZenCoder的答案是當場就,但如果你想永久修復這個權限錯誤,你可以按照在本教程:https://docs.npmjs.com/getting-started/fixing-npm-permissions

既然你是在Mac上,你可以實際上避免NPM權限錯誤完全由剛剛通過,而不是homebrew安裝節點:

brew install node(這將安裝NPM太)

Homebrew installs programs to a directory that doesn't require sudo for write,這樣你就可以npm install -g <whatever>沒有它自由。

+0

好的補充答案! – 2014-12-08 09:46:19