Error: setuid user id does not exist npm ERR! when npm install forever -g

匿名 (未验证) 提交于 2019-12-03 01:34:02

问题:

os: debian 7

node.js is installed in the defalut folder .

root@10-4-4-159:/usr/local# npm install forever -g

npm ERR! Error: setuid user id does not exist

npm ERR! at /usr/local/lib/node_modules/npm/node_modules/uid-number/uid-number.js:44:16

npm ERR! at ChildProcess.exithandler (child_process.js:635:7)

npm ERR! at ChildProcess.EventEmitter.emit (events.js:98:17)

npm ERR! at maybeClose (child_process.js:735:16)

npm ERR! at Process.ChildProcess._handle.onexit (child_process.js:802:5)

npm ERR! If you need help, you may report this log at:

npm ERR! http://github.com/isaacs/npm/issues

npm ERR! or email it to:

npm ERR!

npm ERR! System Linux 3.2.0-4-amd64

npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "forever" "-g"

npm ERR! cwd /usr/local

npm ERR! node -v v0.10.21

npm ERR! npm -v 1.3.11

npm ERR!

npm ERR! Additional logging details can be found in:

npm ERR! /usr/local/npm-debug.log

npm ERR! not ok code 0

回答1:

Work around for this issue:

Open the file below in your editor:

/usr/local/lib/node_modules/npm/node_modules/uid-number/uid-number.js

Goto line 11, then replace uidSupport = process.getuid && process.setuid with uidSupport = false



回答2:

For those who want just a quick shell oneliner to fix the issue.
Linux:
sed -i'' -r 's/^( +, uidSupport = ).+$/\1false/' /path/to/uid-number.js

FreeBSD:
sed -i'' -e -E 's/^( +, uidSupport = ).+$/\1false/' /path/to/uid-number.js



回答3:

Root cause: npm assumes nobody as user while calling process.getuid, which fails if your system does not have an user called nobody.

Solution: create a new user called nobody and try again! sudo adduser --no-create-home --shell /dev/null --disabled-password --disabled-login --gecos '' nobody



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!