when trying to run below command to install java dependencies for NPM it is giving the whole bunch of errors.
NPM install -g java
Someone please help me to rectify the error.
C:\WINDOWS\system32>npm i -g java
[email protected] install C:\Dev\Software\npm-repository\npm\node_modules\java node-gyp rebuild
C:\Dev\Software\npm-repository\npm\node_modules\java>if not defined npm_config_node_gyp (node "C:\Dev\Software\npm-repository\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Dev\Software\npm-repository\npm\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: This is most likely not a problem with node-gyp or the package itself and
gyp ERR! stack is related to network connectivity. In most cases you are behind a proxy or have bad
gyp ERR! stack network settings.
gyp ERR! stack at Request.<anonymous> (C:\Dev\Software\npm-repository\npm\node_modules\npm\node_modules\node-gyp\lib\install.js:171:21)
gyp ERR! stack at Request.emit (events.js:315:20)
gyp ERR! stack at Request.onRequestError (C:\Dev\Software\npm-repository\npm\node_modules\npm\node_modules\request\request.js:881:8)
gyp ERR! stack at ClientRequest.emit (events.js:315:20)
gyp ERR! stack at TLSSocket.socketErrorListener (_http_client.js:469:9)
gyp ERR! stack at TLSSocket.emit (events.js:315:20)
gyp ERR! stack at emitErrorNT (internal/streams/destroy.js:106:8)
gyp ERR! stack at emitErrorCloseNT (internal/streams/destroy.js:74:3)
gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:80:21)
gyp ERR! System Windows_NT 10.0.19042
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Dev\\Software\\npm-repository\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Dev\Software\npm-repository\npm\node_modules\java
gyp ERR! node -v v14.16.1
gyp ERR! node-gyp -v v5.1.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.
CodePudding user response:
Try executing npm i -g node-gyp
first and then execute the above command.
Comment if you get any errors!
CodePudding user response:
Still getting same error
C:\Program Files\nodejs\node_modules\npm>npm i -g java
> [email protected] install C:\Dev\Software\npm-repository\npm\node_modules\java
> node-gyp rebuild
C:\Dev\Software\npm-repository\npm\node_modules\java>if not defined npm_config_node_gyp (node "C:\Dev\Software\npm-repository\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Dev\Software\npm-repository\npm\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: This is most likely not a problem with node-gyp or the package itself and
gyp ERR! stack is related to network connectivity. In most cases you are behind a proxy or have bad
gyp ERR! stack network settings.
gyp ERR! stack at Request.<anonymous> (C:\Dev\Software\npm-repository\npm\node_modules\npm\node_modules\node-gyp\lib\install.js:171:21)
gyp ERR! stack at Request.emit (events.js:315:20)
gyp ERR! stack at Request.onRequestError (C:\Dev\Software\npm-repository\npm\node_modules\npm\node_modules\request\request.js:881:8)
gyp ERR! stack at ClientRequest.emit (events.js:315:20)
gyp ERR! stack at TLSSocket.socketErrorListener (_http_client.js:469:9)
gyp ERR! stack at TLSSocket.emit (events.js:315:20)
gyp ERR! stack at emitErrorNT (internal/streams/destroy.js:106:8)
gyp ERR! stack at emitErrorCloseNT (internal/streams/destroy.js:74:3)
gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:80:21)
gyp ERR! System Windows_NT 10.0.19042
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Dev\\Software\\npm-repository\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Dev\Software\npm-repository\npm\node_modules\java
gyp ERR! node -v v14.16.1
gyp ERR! node-gyp -v v5.1.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.