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

我正在试图做一个项目,需要'ref'npm安装,我得到这个错误。 任何想法我怎么能纠正这一点?

我有nvm runnning和node -v = 0.10.26

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

节点gyp重build

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 

这表明你没有创build目录的权限。

它看起来像原来的项目是作为根安装(由/root在path中隐含) – 所以你必须以root身份运行安装。

尝试mkdir'/ root / node-ffi-libvirt / nodejs-usage / ffi-libvirt / node_modules / ref / build'与正在运行命令的用户。 解决这个问题,然后运行你的命令。