在Ubuntu 18.0.4上安装npm-java时出错

时间:2019-02-04 11:46:41

标签: npm npm-install

我拥有最新的npm 6.7.0版本。我尝试安装npm-java模块,但出现以下错误。在这里我可以看到权限问题,但是我正在使用sudo以root权限运行它。此问题的原因是什么?如何解决?

malintha@malintha-laptop:~$ sudo npm -g install java 

> java@0.11.0 install /usr/local/lib/node_modules/java
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/java/build'
gyp ERR! System Linux 4.15.0-44-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/java
gyp ERR! node -v v8.9.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! java@0.11.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the java@0.11.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/malintha/.npm/_logs/2019-02-04T11_42_36_223Z-debug.log

1 个答案:

答案 0 :(得分:0)

解决了从安装命令中删除sudo的问题。只需运行npm install java