[英]node.js npm error when installing plugins with -g
嘗試全局安裝express並收到此錯誤。 我在x86 qnap上運行node.js版本0.10.24。
[/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
轉到第11行並用uidSupport = false
替換uidSupport = process.getuid && process.setuid
QNAP在Linux系統上缺少幾個系統用戶,因此一些軟件在QNAP上無法正常運行,包括開箱即用的配置,包括節點。
解決您的問題:創建用戶nobody 。 您可以使用adduser -D -H nobody
或NAS的web ui。
祝好運!
Node.js v5.8.0 下載頁面
試試這個: 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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.