欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

npm install 失败 解决

程序员文章站 2022-05-30 16:29:09
...

bug场景:项目 git 运行 npm install

提示:node 版本 v14.17.0


问题描述:安装失败

ps:安装失败后的报错信息

$ npm install
npm WARN deprecated [email protected]1.0.0: Critical security bugs fixed in 2.5.5
npm WARN deprecated [email protected]1.11.0: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated [email protected]3.0.2: Please update to at least constantinople 3.1.1
npm WARN deprecated [email protected]0.3.5: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated [email protected]2.1.0: Deprecated, use jstransformer
npm WARN deprecated [email protected]0.0.5: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]2.16.6: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]3.2.6: Please use the native JSON object instead of JSON 3
npm WARN deprecated [email protected]2.9.203: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated node-[email protected]1.4.8: Use uuid module instead
npm WARN deprecated [email protected]0.10.2: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated [email protected]0.3.8: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]0.1.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]0.7.6: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]0.1.4: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
> [email protected]0.4.31 install D:\AndroidProject\ProjectRTC\ProjectRTC-master\node_modules\ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)


D:\AndroidProject\ProjectRTC\ProjectRTC-master\node_modules\ws>if not defined npm_config_node_gyp (node "D:\app\node\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "D:\app\node\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN notsup Unsupported engine for [email protected]0.10.2: wanted: {"node":"0.8.x"} (current: {"node":"14.17.0","npm":"6.14.13"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]0.10.2
npm WARN notsup Unsupported engine for [email protected]0.7.6: wanted: {"node":"0.8.x"} (current: {"node":"14.17.0","npm":"6.14.13"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]0.7.6
npm WARN notsup Unsupported engine for [email protected]0.1.3: wanted: {"node":"0.8.x"} (current: {"node":"14.17.0","npm":"6.14.13"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]0.1.3
npm WARN notsup Unsupported engine for [email protected]0.3.8: wanted: {"node":"0.8.x"} (current: {"node":"14.17.0","npm":"6.14.13"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]0.3.8
npm WARN notsup Unsupported engine for [email protected]0.1.4: wanted: {"node":"0.8.x"} (current: {"node":"14.17.0","npm":"6.14.13"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]0.1.4
npm WARN [email protected]0.4.0 No license field.

added 283 packages from 219 contributors in 454.723s

36 packages are looking for funding
  run `npm fund` for details


原因分析:没有 gyp


解决方案:

第一步:安装gyp,使用命令:npm install -g node-gyp
第二部:设置gyp的配置信息,使用命令:npm config set node_gyp "node C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js"

相关标签: npm nodejs