当尝试运行下面的命令来安装NPM的Java依赖项时,它会出现一系列错误。
NPM安装-g java
请有人帮我纠正这个错误。
C:\windows\system32〉系统管理器
java@0.12.2安装C:\Dev\软件\npm-存储库\npm\节点模块\java节点-gyp重建
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! java@0.12.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the java@0.12.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2条答案
按热度按时间umuewwlo1#
请尝试先执行
npm i -g node-gyp
,然后再执行上述命令。如果出现任何错误,请进行注解!
kpbpu0082#
VPN连接是这些
npm i
错误的常见原因。请尝试运行断开与VPN连接的命令。