nodejs npm安装错误,如何更正?

时间:2014-03-08 10:25:38

标签: javascript node.js npm nvm

我正在尝试在需要'ref'的项目上执行npm install,我收到此错误。任何想法我怎么能纠正这个?

我有nvm runnning和node -v = 0.10.26

ref@0.1.3 install / 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

2 个答案:

答案 0 :(得分:1)

这表示您无权创建目录。

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

答案 1 :(得分:0)

使用您运行命令的用户尝试mkdir'/ root / node -ffi-libvirt / nodejs-usage / ffi-libvirt / node_modules / ref / build'。先修复它,然后再运行命令。