gpt4 book ai didi

node.js - npm安装jdbc出错

转载 作者:太空宇宙 更新时间:2023-11-04 00:13:03 36 4
gpt4 key购买 nike

我遇到了一些依赖项和错误的问题,我无法找出这些错误的确切原因。

请帮助我提供需要执行的所需步骤。

错误看起来如下所示:

C:\>npm install jdbc
> java@0.9.0 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! 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:\Users\DC250042\AppData\Roaming\npm-cache\_logs\2018-02-01T12_48_39_214Z-debug.log"

最佳答案

有同样的问题。获取 JDK(不是 JRE)并将 JAVA_HOME 设置为 JDK 主文件夹后解决。

构建失败:

   > 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

关于node.js - npm安装jdbc出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48601607/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com