安装yeoman时出错

时间:2016-05-18 10:23:45

标签: ubuntu npm yo

我正在尝试在我的ubuntu v16.4 LTS上安装你,但是我收到了这个错误:

npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
npm ERR! Linux 4.4.0-22-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "yo"
npm ERR! node v6.2.0
npm ERR! npm  v3.9.0
npm ERR! path /usr/local/lib/node_modules/yo/lib/cli.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod

npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/yo/lib/cli.js'
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/yo/lib/cli.js'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /home/momor1/npm-debug.log

如你所见,我有最新的npm和nodejs,而且我处于root模式,所以我仍然不知道为什么它会抛出这个错误。任何帮助请:)

2 个答案:

答案 0 :(得分:13)

当您尝试安装今天发布的最新版本(2016/04/18)时,似乎发生了此错误:1.8.2

请尝试安装上一个版本:

sudo npm install -g yo@1.8.1

现在这对我有用。使用OS X El Capitan v10.11.2,节点4.4.4和npm 3.9.0以及使用OS X 10.11.5的开发人员计算机在干净的虚拟机上进行测试。

答案 1 :(得分:0)

感谢@jcollum帮我找到解决方案,问题是yo需要在sudo模式下安装一些插件(这是不可能的,因为安装是由你自动安装的)。将npm的前缀设置为home将解决每次需要安装新包时使用sudo的问题。只需按照本教程操作即可安装yo@1.8.3。最好的运气http://www.competa.com/blog/2014/12/how-to-run-npm-without-sudo/