使用-g安装插件时node.js npm错误

标签 node.js npm

尝试全局安装 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 中无法正常工作

work-around 告诉 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 = process.getuid && process.setuid 替换为 uidSupport = false

关于使用-g安装插件时node.js npm错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21114398/

相关文章:

javascript - setTimeout 会阻止函数被垃圾收集吗?

node.js - 如何在本地设置多个 NPM 用户?

node.js - 管理 2 个以上具有依赖关系的 Nodejs 包的开发

css - 为什么在我运行 npm install [someLibraryName] 时会安装 css?

mysql - node-mysql 正确转义具有唯一条件的批量删除

node.js - 如何将中间件包装在函数中?

javascript - 监听服务器时,提示服务器未定义。还有其他方法可以监听服务器吗?

javascript - 使用 CORS 仍然会出现跨源错误

npm - 无法发布到 npm 注册表,401 错误

ios - 如何以交互模式运行expo?