尝试加载 binding.gyp 时调用 'node findJavaHome.js' 返回退出状态 1。
Call to 'node findJavaHome.js' returned exit status 1. while trying to load binding.gyp
尝试在节点 "npm install -g java" 上安装 java 时,我一直收到此错误。
[node-java] Error: not found: javac
gyp: Call to 'node findJavaHome.js' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.13.0-73-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/java
gyp ERR! node -v v4.4.1
gyp ERR! node-gyp -v v3.3.0
gyp ERR! not ok
npm ERR! Linux 3.13.0-73-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "java"
npm ERR! node v4.4.1
npm ERR! npm v2.14.20
npm ERR! code ELIFECYCLE
我试过的一些命令:
>which java
/opt/java/jdk1.7.0_79/bin/java
>$JAVA_HOME
bash: /opt/java/jdk1.7.0_79
>javac
Usage: javac <options> <source files>...
在 node-java 包中,当我执行:"node findJavaHome.js" 我得到“/opt/java/jdk1.7.0_79”
看起来这是由于使用 sudo
造成的,默认情况下不保留我的用户环境,所以我的 JAVA_HOME
没有被读取。此命令有效:sudo -E npm install
.
通过
安装java编译器
sudo apt-get install default-jdk
尝试在节点 "npm install -g java" 上安装 java 时,我一直收到此错误。
[node-java] Error: not found: javac
gyp: Call to 'node findJavaHome.js' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.13.0-73-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/java
gyp ERR! node -v v4.4.1
gyp ERR! node-gyp -v v3.3.0
gyp ERR! not ok
npm ERR! Linux 3.13.0-73-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "java"
npm ERR! node v4.4.1
npm ERR! npm v2.14.20
npm ERR! code ELIFECYCLE
我试过的一些命令:
>which java
/opt/java/jdk1.7.0_79/bin/java
>$JAVA_HOME
bash: /opt/java/jdk1.7.0_79
>javac
Usage: javac <options> <source files>...
在 node-java 包中,当我执行:"node findJavaHome.js" 我得到“/opt/java/jdk1.7.0_79”
看起来这是由于使用 sudo
造成的,默认情况下不保留我的用户环境,所以我的 JAVA_HOME
没有被读取。此命令有效:sudo -E npm install
.
通过
安装java编译器sudo apt-get install default-jdk