2014-07-04 20 views
2

我試圖使用NPM安裝約曼,但我通過下面的錯誤招呼:錯誤安裝呦,雖然採用了棱角分明發電機

Jaspers-MacBook-Pro:Sites Jasper$ sudo npm install --global yo 

> [email protected] install /usr/local/lib/node_modules/yo/node_modules/fullname/node_modules/fullname-native 
> node-gyp rebuild 

gyp ERR! UNCAUGHT EXCEPTION 
gyp ERR! stack Error: EPERM, utime '/Users/Jasper/.node-gyp/0.10.29' 
gyp ERR! System Darwin 13.3.0 
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" 
gyp ERR! cwd /usr/local/lib/node_modules/yo/node_modules/fullname/node_modules/fullname-native 
gyp ERR! node -v v0.10.29 
gyp ERR! node-gyp -v v0.13.1 
gyp ERR! This is a bug in `node-gyp`. 
gyp ERR! Try to update node-gyp and file an Issue if it does not help: 
gyp ERR!  <https://github.com/TooTallNate/node-gyp/issues> 
npm WARN optional dep failed, continuing [email protected] 
/usr/local/bin/yo -> /usr/local/lib/node_modules/yo/cli.js 

> [email protected] postinstall /usr/local/lib/node_modules/yo 
> node ./scripts/doctor 

[Yeoman Doctor] Everything looks alright! 

npm WARN unmet dependency /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/download/node_modules/request/node_modules/form-data requires [email protected]'~0.9.0' but will load 
npm WARN unmet dependency /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/node_modules/async, 
npm WARN unmet dependency which is version 0.2.10 

由於約曼醫生說,「看起來還好吧」,我試圖安裝德角發電機

npm install -g generator-angular yo angular

這只是返回一些錯誤:

npm ERR! Error: EACCES, open '/Users/Jasper/.npm/lodash/2.4.1/package/package.json' 
npm ERR! { [Error: EACCES, open '/Users/Jasper/.npm/lodash/2.4.1/package/package.json'] 
npm ERR! errno: 3, 
npm ERR! code: 'EACCES', 
npm ERR! path: '/Users/Jasper/.npm/lodash/2.4.1/package/package.json', 
npm ERR! parent: 'grunt-karma' } 
npm ERR! 
npm ERR! Please try running this command again as root/Administrator. 

npm ERR! System Darwin 13.3.0 
npm ERR! command "node" "/usr/local/bin/npm" "install" "karma-phantomjs-launcher" "karma-jasmine" "grunt-karma" "--save-dev" 
npm ERR! cwd /Users/Jasper/Sites/test 
npm ERR! node -v v0.10.29 
npm ERR! npm -v 1.4.14 
npm ERR! path /Users/Jasper/.npm/lodash/2.4.1/package/package.json 
npm ERR! code EACCES 
npm ERR! errno 3 
npm ERR! stack Error: EACCES, open '/Users/Jasper/.npm/lodash/2.4.1/package/package.json' 
npm ERR! Error: EACCES, open '/Users/Jasper/.npm/findup-sync/0.1.3/package/package.json' 
npm ERR! { [Error: EACCES, open '/Users/Jasper/.npm/findup-sync/0.1.3/package/package.json'] 
npm ERR! errno: 3, 
npm ERR! code: 'EACCES', 
npm ERR! path: '/Users/Jasper/.npm/findup-sync/0.1.3/package/package.json', 
npm ERR! parent: 'load-grunt-tasks' } 
npm ERR! 
npm ERR! Please try running this command again as root/Administrator. 

npm ERR! System Darwin 13.3.0 
npm ERR! command "node" "/usr/local/bin/npm" "install" 
npm ERR! cwd /Users/Jasper/Sites/test 
npm ERR! node -v v0.10.29 
npm ERR! npm -v 1.4.14 
npm ERR! path /Users/Jasper/.npm/findup-sync/0.1.3/package/package.json 
npm ERR! code EACCES 
npm ERR! errno 3 
npm ERR! stack Error: EACCES, open '/Users/Jasper/.npm/findup-sync/0.1.3/package/package.json' 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  /Users/Jasper/Sites/test/npm-debug.log 
npm ERR! not ok code 0 

我試圖更新節點GYP,卸載的節點,並通過自制程序,但沒有成功重新安裝...

如果我安裝使用sudo發電機,運行yo angular返回以下

npm ERR! System Darwin 13.3.0 npm ERR! command "node" "/usr/local/bin/npm" "install" "karma-phantomjs-launcher" "karma-jasmine" "grunt-karma" "--save-dev" npm ERR! cwd /Users/Jasper/.npm/lodash/2.4.1/package npm ERR! node -v v0.10.29 npm ERR! npm -v 1.4.14 npm ERR! path /Users/Jasper/.npm/mkdirp/0.3.5/package/package.json npm ERR! code EACCES npm ERR! errno 3 npm ERR! stack Error: EACCES, open '/Users/Jasper/.npm/mkdirp/0.3.5/package/package.json' npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /Users/Jasper/.npm/lodash/2.4.1/package/npm-debug.log npm ERR! not ok code 0

不明白爲什麼這是行不通的,因爲我有它之前

工作我在一個乾淨的安裝OSX小牛

碧玉

+0

你的第二個命令需要'sudo'預謀也是如此。雖然這可能無法解決所有問題,但我不喜歡運行1st命令的輸出外觀。 – alandarev

+0

@alandarev嘗試了幾乎所有的東西sudo ...沒有快樂:( – JasperZelf

+0

我沒有說它會排序你的問題,但第二個命令的輸出是「對不起,賈斯珀,我沒有權利」,因此我們看不到任何有意義的東西從第二條命令開始記錄,你確實有第一條命令發生,因此第二條命令也會失敗 – alandarev

回答

19

我有類似的問題。開始使用固定權限問題:

sudo chown -R `whoami` ~/.npm 
sudo chown -R `whoami` /usr/local/lib/node_modules 

這是一個受歡迎的問題:npm throws error without sudo

+0

謝謝!我是Linux/Mac的新手,這對我非常有幫助。乾杯! –