0

使用“npm install -g”命令安装 pm2 时,出现此错误。我不知道为什么将“-g”选项附加到当前工作目录然后它返回ENOENT(没有这样的文件或目录)任何人都遇到过这个问题,请帮助解决这个问题。提前谢谢了。以下是安装时的日志:

[root@XXXXX folder]# npm install –g pm2@1.0.1
npm ERR! addLocal Could not install /path/to/project/folder/–g
npm ERR! fetch failed https://registry.npmjs.org/pm2/-/pm2-1.0.1.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 400
npm ERR! fetch failed https://registry.npmjs.org/pm2/-/pm2-1.0.1.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 400
npm ERR! fetch failed https://registry.npmjs.org/pm2/-/pm2-1.0.1.tgz
npm ERR! Linux 2.6.32-431.el6.x86_64
npm ERR! argv "/opt/dtv/node-v4.2.6-linux-x64/bin/node" "/opt/dtv/node-v4.2.6-linux-x64/bin/npm" "install" "–g" "pm2@1.0.1"
npm ERR! node v4.2.6
npm ERR! npm v2.14.12
npm ERR! path /path/to/project/folder/–g
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open '/path/to/project/folder/–g'
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
4

1 回答 1

0

顺序颠倒,试试:npm install pm2@1.0.1 -g

于 2016-05-06T04:45:38.497 回答