npm install pm2 -g 报错 求指教
发布于 12 年前 作者 q1270989 34950 次预览 最后一次回复是 10 年前 来自
OSError: [Errno 13] Permission denied
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 2.6.32-042stab083.2
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/pm2/node_modules/usage
gyp ERR! node -v v0.10.24
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok
npm http GET https://registry.npmjs.org/keypress
npm http 200 https://registry.npmjs.org/keypress
npm http GET https://registry.npmjs.org/keypress/-/keypress-0.1.0.tgz
npm http 200 https://registry.npmjs.org/keypress/-/keypress-0.1.0.tgz
npm ERR! usage[@0](/user/0).3.9 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the usage[@0](/user/0).3.9 install script.
npm ERR! This is most likely a problem with the usage package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls usage
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 2.6.32-042stab083.2
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "pm2" "-g"
npm ERR! cwd /usr/src/node-v0.10.24
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /usr/src/node-v0.10.24/npm-debug.log
npm ERR! not ok code 0
求教新弄了个VPS 结果安装 npm install pm2 -g
报错 请问咋回事?
补充一下 运行 npm install pm2 -g 会报错 运行 sudo npm install pm2 -g 提示 sudo:npm:找不到命令
系统是 centos6 64位
19 回复
which node跑一下看下, 怀疑 Node 安装方式有问题,node命令没出现在$PATH指定的路径里which node 返回 /usr/local/bin/node 这样对么?
我是下的源码 然后直接 make install .
我现在node能跑,forever能跑,就是pm2安装不上 好郁闷.
@q1270989 不明白了…
npm命令也是这样的吗?@jiyinyiyong 嗯 现在就是npm install pm2 -g 报错
我安装forever express jade socket.io 全部都没问题
好郁闷
sudo !!
-g 全局安装…你没权限啊…需要sudo啊…
@q1270989 … 难道真的因为
sudo, 前边几个命令怎么成功了@jiyinyiyong 前面那几个不是全局安装…
@jiyinyiyong 但是我一用sudo npm 就是报错
@youxiachai forever 是全局的
用 sudo 提示 sudo:npm:找不到命令
@q1270989 多给些参数吧, 普通用户, root, 的 $PATH, 各种安装路径等等
@jiyinyiyong 私信你 VPS帐号
报错没贴全的样子, 一部分我附在后边了… 汗, 没能搞定… 大致了解到的东西,
sudosudo env的环境$PATH里没有/usr/local/bin/, 所以找不到命令… 我不是很清楚sudo开的进程是怎么 copy 环境变量的, 反正比较奇怪. 我尝试创建一个有sudo权限的账户, 结果进入sudo模式$PATH还是缺的/usr/local/bin/下https://github.com/Unitech/pm2/issues/232#issuecomment-31238551
看到一个貌似跟我错误一样的 不知道pm2的人能解答不
其实我没sudo,好像也全局安装了
前面能成功是因为 npm install 的默认路径是 ~/.npm 一般都有权限…
sudo 不成功要么是脚本没有可执行权限,或者 sudo 的 PATH 跟当前帐号不一样。
http://stackoverflow.com/questions/12996397/command-not-found-when-using-sudo
跟你贴的这个issue 应该关系不大…
汗,今天遇到和你一样的事情,结果是因为root 默认环境变量里面没有/usr/local/bin,所以root找不到node和npm,sudo npm就报错了,在/etc/sudoers里面加上这个路径久可以了
怎么解决的?