jdbc节点程序包中的安装失败

时间:2018-12-13 07:38:37

标签: node.js npm-install

我对nodejs有点陌生,我正在尝试通过nodejs连接数据库。为了进行连接,我正在安装JDBC,但它抛出如下错误。你可以帮忙吗?

 C:\myDrive\work\samples\nodeapis\simpleapi>npm i --save jdbc

    > java@0.9.1 install `enter code here`C:\myDrive\work\samples\nodeapis\simpleapi\node_modules\java
    > node-gyp rebuild


    C:\myDrive\work\samples\nodeapis\simpleapi\node_modules\java>if not defined npm_config_node_gyp (node "C:\myDrive\apps\node-v10.14.1-win-x64\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\myDrive\apps\node-v10.14.1-win-x64\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
    gyp ERR! configure error
    gyp ERR! stack Error: Command failed: C:\myDrive\apps\Python\Python37\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
    gyp ERR! stack   File "<string>", line 1
    gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
    gyp ERR! stack                                ^
    gyp ERR! stack SyntaxError: invalid syntax
    gyp ERR! stack
    gyp ERR! stack     at ChildProcess.exithandler (child_process.js:289:12)
    gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
    gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
    gyp ERR! System Windows_NT 10.0.14393
    gyp ERR! command "C:\\myDrive\\apps\\node-v10.14.1-win-x64\\node.exe" "C:\\myDrive\\apps\\node-v10.14.1-win-x64\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
    gyp ERR! cwd C:\myDrive\work\samples\nodeapis\simpleapi\node_modules\java
    gyp ERR! node -v v10.14.1
    gyp ERR! node-gyp -v v3.8.0
    gyp ERR! not ok
    npm WARN enoent ENOENT: no such file or directory, open 'C:\myDrive\work\samples\nodeapis\simpleapi\package.json'
    npm WARN simpleapi No description
    npm WARN simpleapi No repository field.
    npm WARN simpleapi No README data
    npm WARN simpleapi No license field.

    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!     C:\Users\<user>\AppData\Roaming\npm-cache\_logs\2018-12-13T07_30_29_595Z-debug.log

我安装了较低版本的python 2.7.0之后,此错误消失了。

但出现以下错误

C:\myDrive\work\samples\nodeapis\simpleapi>npm i --save jdbc
> java@0.9.1 install C:\myDrive\work\samples\nodeapis\simpleapi\node_modules\java
> node-gyp rebuild


C:\myDrive\work\samples\nodeapis\simpleapi\node_modules\java>if not defined npm_config_node_gyp (node "C:\myDrive\apps\node-v10.14.1-win-x64\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\myDrive\apps\node-v10.14.1-win-x64\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: read ECONNRESET
gyp ERR! stack     at TLSWrap.onStreamRead (internal/stream_base_commons.js:111:27)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\myDrive\\apps\\node-v10.14.1-win-x64\\node.exe" "C:\\myDrive\\apps\\node-v10.14.1-win-x64\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\myDrive\work\samples\nodeapis\simpleapi\node_modules\java
gyp ERR! node -v v10.14.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'C:\myDrive\work\samples\nodeapis\simpleapi\package.json'
npm WARN simpleapi No description
npm WARN simpleapi No repository field.
npm WARN simpleapi No README data
npm WARN simpleapi No license field.

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!     C:\Users\<user>\AppData\Roaming\npm-cache\_logs\2018-12-13T08_15_21_567Z-debug.log

预先感谢

1 个答案:

答案 0 :(得分:0)

我认为您需要安装node-gyp,然后再试一次,它是一个用nodejs编写的跨平台命令行工具,用于编译本机插件模块。