我面临着一些依赖和一些错误,我无法找出这些错误的确切原因一定的几个问题。
请帮我提供所需的步骤需要执行。
错误似乎看起来象下面这样:
C:\>npm install jdbc
> [email protected] install C:\node_modules\java
> node-gyp rebuild
C:\node_modules\java>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
[node-java] Error: not found: javac.exe
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 (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:336:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\node_modules\java
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'C:\package.json'
npm WARN !invalid#1 No description
npm WARN !invalid#1 No repository field.
npm WARN !invalid#1 No README data
npm WARN !invalid#1 No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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! C:\Users\DC250042\AppData\Roaming\npm-cache\_logs\2018-02-01T12_48_39_214Z-debug.log"
有同样的问题。解决后得到JDK(不是JRE),并设置JAVA_HOME为JDK主文件夹。
构建失败:
> [email protected] install /tmp/app/node_modules/jdbc/node_modules/java
> node-gyp rebuild
[node-java] Error: not found: javac
gyp ERR! stack Error: `gyp` failed with exit code: 1
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 at ChildProcess.onCpExit (/tmp/app/vendor/node/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.4.0-75-generic
gyp ERR! command "/tmp/app/vendor/node/bin/node" "/tmp/app/vendor/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/app/node_modules/jdbc/node_modules/java
gyp ERR! node -v v8.11.4
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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/vcap/.npm/_logs/2019-02-03T06_06_30_610Z-debug.log
打造成功:
> [email protected] install /tmp/app/node_modules/jdbc/node_modules/java
> node-gyp rebuild
make: Entering directory `/tmp/app/node_modules/jdbc/node_modules/java/build'
CXX(target) Release/obj.target/nodejavabridge_bindings/src/java.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/javaObject.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/javaScope.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/methodCallBaton.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/nodeJavaBridge.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/utils.o
SOLINK_MODULE(target) Release/obj.target/nodejavabridge_bindings.node
COPY Release/nodejavabridge_bindings.node
make: Leaving directory `/tmp/app/node_modules/jdbc/node_modules/java/build'
> [email protected] install /tmp/app/node_modules/java
> node-gyp rebuild
make: Entering directory `/tmp/app/node_modules/java/build'
CXX(target) Release/obj.target/nodejavabridge_bindings/src/java.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/javaObject.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/javaScope.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/methodCallBaton.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/nodeJavaBridge.o
CXX(target) Release/obj.target/nodejavabridge_bindings/src/utils.o
SOLINK_MODULE(target) Release/obj.target/nodejavabridge_bindings.node
COPY Release/nodejavabridge_bindings.node
make: Leaving directory `/tmp/app/node_modules/java/build'
> [email protected] postinstall /tmp/app/node_modules/jdbc/node_modules/java
> node postInstall.js
> [email protected] postinstall /tmp/app/node_modules/java
> node postInstall.js
added 14 packages from 16 contributors and audited 7320 packages in 57.174s
found 7 vulnerabilities (1 low, 6 moderate)
run `npm audit fix` to fix them, or `npm audit` for details