我面临着某些依赖项的一些问题,而我无法弄清楚这些错误的确切原因。
请提供需要执行所需的步骤来帮助我。
错误似乎如下所示:
C:>npm install jdbc
> java@0.9.0 install C:node_modulesjava
> node-gyp rebuild
C:node_modulesjava>if not defined npm_config_node_gyp (node "C:Program Filesnodejsnode_modulesnpmnode_modulesnpm-lifecyclenode-gyp-bin\....node_modulesnode-gypbinnode-gyp.js" rebuild ) else (node "C:Program Filesnodejsnode_modulesnpmnode_modulesnode-gypbinnode-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 Filesnodejsnode_modulesnpmnode_modulesnode-gyplibconfigure.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_modulesjava
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! java@0.9.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the java@0.9.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! C:UsersDC250042AppDataRoamingnpm-cache_logs2018-02-01T12_48_39_214Z-debug.log"
也有同样的问题。在获得JDK(而非JRE(之后解决,并将Java_home设置为JDK Home Folder。
构建失败:
> java@0.9.1 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! java@0.9.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the java@0.9.1 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
构建成功:
> java@0.9.1 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'
> java@0.11.0 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'
> java@0.9.1 postinstall /tmp/app/node_modules/jdbc/node_modules/java
> node postInstall.js
> java@0.11.0 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