javascript - nodejs npm安装错误,如何纠正?

标签 javascript node.js npm nvm

我尝试在需要“ref”的项目上进行 npm install,但收到此错误。知道如何纠正这个问题吗?

我有 nvm 正在运行并且 Node -v = 0.10.26

ref@0.1.3 安装/root/node-ffi-libvirt/nodejs-usage/ffi-libvirt/node_modules/ref

node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: EACCES, mkdir '/root/node-ffi-libvirt/nodejs-usage/ffi-libvirt/node_modules/ref/build'
gyp ERR! System Linux 3.11.0-12-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /root/node-ffi-libvirt/nodejs-usage/ffi-libvirt/node_modules/ref
gyp ERR! node -v v0.10.15
gyp ERR! node-gyp -v v0.10.9
gyp ERR! not ok 
npm ERR! ref@0.1.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ref@0.1.3 install script.
npm ERR! This is most likely a problem with the ref 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 ref
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "node" "/root/.nvm/v0.10.26/bin/npm" "install" "ref"
npm ERR! cwd /root/node-ffi-libvirt/nodejs-usage/ffi-libvirt
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.4

最佳答案

这表明您没有创建目录的权限。

看起来原始项目是以 root 身份安装的(由路径中的 /root 暗示) - 因此您也必须以 root 身份运行安装。

关于javascript - nodejs npm安装错误,如何纠正?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22268063/

相关文章:

macos - 是否可以在不调用 `node` 的情况下运行 Node.js 脚本?

node.js - 无法使用 npm 安装 asyncawait

amazon-web-services - AWS-CDK 和 Gitlab 返回错误 : spawnSync docker ENOENT

javascript - 如何将 UUID 从 Drupal 用户数据库导出到单个页面上的 javascript 中?

javascript - ChartJS - 删除轴?

javascript - Data Bind RouterLink (Angular 2) - 获得插值 ({{}}),其中第 3 列预期有表达式

javascript - 使用express.js 路线设置来 react 应用程序

node.js - Preact 到底是什么?我可以使用 Node 模块吗?

javascript - 在 for 循环中使用 setTimeout

node.js - 为 npm install --save 指定 semver 运算符