我正在尝试在公司笔记本电脑上安装 npm-jdbc。
我的代码在这里
const express = require( 'express' );
const debug = require( 'debug' )( 'app' );
const path = require( 'path' );
const _ = require( 'lodash' );
const bodyParser = require( 'body-parser' );
var JDBC = require('jdbc');
var jinst = require('jdbc/lib/jinst');
const fs = require( 'fs' );
const persistence = require('./persistence');
const cors = require('cors');
const app = express();
const { exec } = require("child_process");
app.use(cors());
app.use(express.json());
const siteDir = path.join( __dirname, './../out/site/tutorial' );
const MOVIES_PATH = './data/listresponse.json';
const CREO_DATA_PATH = './data/creoresponse.json';
app.use( express.static( siteDir ) );
app.use( bodyParser.urlencoded( { extended: true } ) );
app.use( bodyParser.json() );
if (!jinst.isJvmCreated()) {
jinst.addOption("-Xrs");
jinst.setupClasspath(["C:/Program Files (x86)/H2/bin/h2-2.1.214.jar"]);
}
我收到这个错误
PS C:\Documents\server> npm install jdbc
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
npm ERR! code 1
npm ERR! path C:\Documents\server\node_modules\java
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp ERR! stack FetchError: request to https://nodejs.org/download/release/v16.14.2/node-v16.14.2-headers.tar.gz failed, reason: unable to get local issuer certificate npm ERR! gyp ERR! stack at ClientRequest.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\index.js:110:14) npm ERR! gyp ERR! stack at ClientRequest.emit (node:events:526:28)
npm ERR! gyp ERR! stack at TLSSocket.socketErrorListener (node:_http_client:442:9) npm ERR! gyp ERR! stack at TLSSocket.emit (node:events:538:35)
npm ERR! gyp ERR! stack at emitErrorNT (node:internal/streams/destroy:157:8)
npm ERR! gyp ERR! stack at emitErrorCloseNT (node:internal/streams/destroy:122:3)
npm ERR! gyp ERR! stack at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! gyp ERR! System Windows_NT 10.0.22621
npm ERR! 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" npm ERR! gyp ERR! cwd C:\Documents\server\node_modules\java
npm ERR! gyp ERR! node -v v16.14.2
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok
npm ERR! C:\Users\rushikesh.r\AppData\Local\npm-cache\_logs\2023-03-17T16_24_40_516Z-debug-0.log
我试过了
npm 配置设置 strict-ssl false
npm 配置设置注册表 http://registry.npmjs.org/
设置 NODE_TLS_REJECT_UNAUTHORIZED=0
我已经安装了 vs 2017
安装 python 3.9 首选版本 >=3.7 和 < latest version
安装visual studio community 2019
执行
npm config set msvs_version 2019 --global
执行
npm install -g fs --save-dev
执行
npm config set strict-ssl false
执行
npm config set registry="http://registry.npmjs.org/"
从 C:\Users\user\AppData\Roaming 复制下载的 fs 文件夹 下午 ode_modules 到 $nodehome ode_modules 下午 ode_modules(注意:在我的例子中是 C:\Program Files odejs ode_modules 下午 ode_modules)
在项目目录中运行
npm i jdbc --nodedir=%USERPROFILE%\.node-gyp\16.2.0