node.js npm安装插件时出现错误-g
问题描述:
试图在全局安装express并获取此错误。我在我的x86 qnap上运行node.js版本0.10.24。node.js npm安装插件时出现错误-g
[/share/Qweb/Codiad/workspace/chat] # npm install express -g
npm ERR! Error: setuid user id does not exist
npm ERR! at /share/MD0_DATA/.qpkg/Optware/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 Socket. (child_process.js:948:11)
npm ERR! at Socket.EventEmitter.emit (events.js:95:17)
npm ERR! at Pipe.close (net.js:466:12)
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! System Linux 3.4.6
npm ERR! command "/opt/bin/node" "/opt/bin/npm" "install" "express" "-g"
npm ERR! cwd /share/MD0_DATA/Qweb/Codiad/workspace/chat
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /share/MD0_DATA/Qweb/Codiad/workspace/chat/npm-debug.log
npm ERR! not ok code 0
答
npm
工具不QNAP OS
正常工作的变通告诉npm
是QNAP不支持获取或通过修改npm
源代码中设置用户ID:
开放文件uid-number.js在您的编辑器中:
/share/MD0_DATA/.qpkg/Optware/lib/node_modules/npm/node_modules/uid-number/uid-number.js
转到line 11与uidSupport = false
答
QNAP缺乏可用的情侣系统的用户在Linux系统上,因此一些软件无法正常上QNAP与外的开箱配置,包括节点工作更换uidSupport = process.getuid && process.setuid
。
解决您的问题:创建用户没有人。您可以使用adduser -D -H nobody
或NAS的网络用户界面。
祝你好运!
答
Node.js的V5.8.0 download page
试试这个:node-upgrade.sh
#!/bin/sh
URL=$1
[[ $URL =~ (node-v5\.8\.0-.*)\.tar\.gz$ ]] && TARFile=${BASH_REMATCH[0]} && DirName=${BASH_REMATCH[1]}
[[ $TARFile == "" ]] && echo "url is wrong" && exit
NodeJSPath=$(/sbin/getcfg nodejs Install_Path -f /etc/config/qpkg.conf)
wget --no-check-certificate $URL
tar zxf $TARFile -C $NodeJSPath
rm -r $NodeJSPath/node $TARFile
ln -s $NodeJSPath/$DirName $NodeJSPath/node
uidscript=$NodeJSPath/$DirName/lib/node_modules/npm/node_modules/uid-number/uid-number.js
script="$(cat $uidscript)"
echo "${script/", uidSupport = process.getuid && process.setuid"/, uidSupport = false}" > $uidscript
例如 我的QNAP NAS系列产品是基于Intel x86的系列
sh ./node-upgrade.sh https://nodejs.org/download/release/v5.8.0/node-v5.8.0-linux-x86.tar.gz
https://github.com/npm/npm/issues/3789 –
同样的错误,但没有解决办法:( – Tan
@damphat是本地安装包似乎不工作错误 – Tan