运行`yo angular`时有很多“npm ERR!”

时间:2014-02-18 00:51:39

标签: node.js angularjs yeoman yeoman-generator

我正在努力让Yeoman工作,但这是一个接一个的墙。感谢上帝的stackoverflow和所有你帮助的好人。无论如何......

我一直试图运行yo angular。但我得到了一堆npm ERR!,包括:

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

由于我不能在yo上使用sudo,我遵循了大多数人接受的建议,并改变了一些希望解决这个问题的配置。 Here are the commands I ran,基于the recommendation

但我仍然得到同样的错误!

这是我yo angular的{​​{3}}

这是我yo angular的{​​{3}}

这是我yo angular的{​​{3}}

我该如何解决这些错误?

提前非常感谢你。


更新

在alex建议执行sudo chown ubuntu /home/ubuntu/tmp -Rv之后,root运行错误确实消失了,但是在新目录中运行yo angular之后我仍然遇到这些错误。我用cat -n stderr.log | grep -ir err显示错误(奇怪的是这次没有生成npm-debug.log):

   218  npm ERR! Error: ENOENT, lstat '/home/ubuntu/youtube_5/node_modules/grunt/lib/grunt/task.js'
   219  npm ERR! If you need help, you may report this *entire* log,
   220  npm ERR! including the npm and node versions, at:
   221  npm ERR!     <http://github.com/npm/npm/issues>
   223  npm ERR! System Linux 3.2.0-54-virtual
   224  npm ERR! command "node" "/usr/local/bin/npm" "install" "grunt-karma" "karma-ng-html2js-preprocessor" "karma-ng-scenario" "--save-dev"
   225  npm ERR! cwd /home/ubuntu/youtube_5
   226  npm ERR! node -v v0.10.25
   227  npm ERR! npm -v 1.4.2
   228  npm ERR! path /home/ubuntu/youtube_5/node_modules/grunt/lib/grunt/task.js
   229  npm ERR! fstream_path /home/ubuntu/youtube_5/node_modules/grunt/lib/grunt/task.js
   230  npm ERR! fstream_type File
   231  npm ERR! fstream_class FileWriter
   232  npm ERR! code ENOENT
   233  npm ERR! errno 34
   234  npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
   235  npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
  1102  npm ERR! 
  1103  npm ERR! Additional logging details can be found in:
  1104  npm ERR!     /home/ubuntu/youtube_5/npm-debug.log
  1105  npm ERR! not ok code 0

Update2:经过一些npm-debug.log后,我用sudo npm cache clear解决了这个新的ENOENT问题。

感谢StackOverflow。

2 个答案:

答案 0 :(得分:6)

  

80错误错误:EACCES,mkdir'/ home / ubuntu / tmp / npm-26883-sBYbfAy6'

好的,所以你的/home/ubuntu/tmp拥有错误的权限。之所以发生这种情况,是因为你过去曾sudo npm install,而且npm不能很好地处理这个问题。

运行sudo chown ubuntu /home/ubuntu/tmp -Rv来解决此问题,或者只是删除该文件夹。

答案 1 :(得分:1)

即使在应用上述修复程序后,我也遇到了各种各样的疯狂错误,最后我运行了&#34; chmod -R 777 /home/[moi]/.npm,它现在运行没有任何错误。