安装npm install报错npm ERR! code ETIMEDOUT npm ERR! errno ETIMEDOUT npm ERR! network request to https://registry.npmjs.org/webpack-subresource-integrity failed, reason

发布时间 2024-01-13 16:38:06作者: 封狼居胥_神都

执行命令:npm run dev 启动前端项目报如下错误,vue-cli-service是Vue一个启动的插件,需要安装

D:\nodejs\npm.cmd run dev
> yuntan1hao@2.0.0 dev
> vue-cli-service serve --open
'vue-cli-service' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
Process finished with exit code 1

 

 

执行npm install安装vue-cli-service报错,根据提示可知链接超时:

Windows PowerShell
版权所有(C) Microsoft Corporation。保留所有权利。

安装最新的 PowerShell,了解新功能和改进!https://aka.ms/PSWindows

PS E:\20231213\kuangshan\cepp_web_mine> npm install
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: eslint-config-standard@12.0.0
npm WARN Found: eslint-plugin-node@6.0.1
npm WARN node_modules/eslint-plugin-node
npm WARN   eslint-plugin-node@"^6.0.1" from @vue/eslint-config-standard@3.0.5
npm WARN   node_modules/@vue/eslint-config-standard
npm WARN     dev @vue/eslint-config-standard@"^3.0.0-beta.10" from the root project
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer eslint-plugin-node@">=7.0.0" from eslint-config-standard@12.0.0
npm WARN node_modules/@vue/eslint-config-standard/node_modules/eslint-config-standard
npm WARN   eslint-config-standard@"^12.0.0-alpha.0" from @vue/eslint-config-standard@3.0.5
npm WARN   node_modules/@vue/eslint-config-standard
npm WARN
npm WARN Conflicting peer dependency: eslint-plugin-node@11.1.0
npm WARN node_modules/eslint-plugin-node
npm WARN   peer eslint-plugin-node@">=7.0.0" from eslint-config-standard@12.0.0
npm WARN   node_modules/@vue/eslint-config-standard/node_modules/eslint-config-standard
npm WARN     eslint-config-standard@"^12.0.0-alpha.0" from @vue/eslint-config-standard@3.0.5
npm WARN     node_modules/@vue/eslint-config-standard
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: eslint-config-standard@12.0.0
npm WARN Found: eslint-plugin-promise@undefined
npm WARN node_modules/@vue/eslint-config-standard/node_modules/eslint-plugin-promise
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint-plugin-promise@">=4.0.0" from eslint-config-standard@12.0.0
npm WARN node_modules/@vue/eslint-config-standard/node_modules/eslint-config-standard
npm WARN   eslint-config-standard@"^12.0.0-alpha.0" from @vue/eslint-config-standard@3.0.5
npm WARN   node_modules/@vue/eslint-config-standard
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: eslint-config-standard@12.0.0
npm WARN Found: eslint-plugin-standard@3.1.0
npm WARN node_modules/eslint-plugin-standard
npm WARN   eslint-plugin-standard@"^3.1.0" from @vue/eslint-config-standard@3.0.5
npm WARN   node_modules/@vue/eslint-config-standard
npm WARN     dev @vue/eslint-config-standard@"^3.0.0-beta.10" from the root project
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint-plugin-standard@">=4.0.0" from eslint-config-standard@12.0.0
npm WARN node_modules/@vue/eslint-config-standard/node_modules/eslint-config-standard
npm WARN   eslint-config-standard@"^12.0.0-alpha.0" from @vue/eslint-config-standard@3.0.5
npm WARN   node_modules/@vue/eslint-config-standard
npm WARN
npm WARN Conflicting peer dependency: eslint-plugin-standard@5.0.0
npm WARN node_modules/eslint-plugin-standard
npm WARN   peer eslint-plugin-standard@">=4.0.0" from eslint-config-standard@12.0.0
npm WARN   node_modules/@vue/eslint-config-standard/node_modules/eslint-config-standard
npm WARN     eslint-config-standard@"^12.0.0-alpha.0" from @vue/eslint-config-standard@3.0.5
npm WARN     node_modules/@vue/eslint-config-standard
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/webpack-subresource-integrity failed, reason:
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in: D:\nodejs\node_cache\_logs\2024-01-13T07_50_13_728Z-debug-0.log
PS E:\20231213\kuangshan\cepp_web_mine>

执行npm config set registry https://registry.npm.taobao.org切换镜像后再次执行npm install又报错ERESOLVE could not resolve,可能是由于项目里各种版本的插件不一致,而插件之间又相互之间形成了依赖关系,但是npm7及以上版本中npm默认是对peer依赖进行验证。

PS E:\20231213\kuangshan\cepp_web_mine> npm config set registry https://registry.npm.taobao.org
PS E:\20231213\kuangshan\cepp_web_mine> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: yuntan1hao@2.0.0
npm ERR! Found: webpack@4.46.0
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"^4.0.0" from @intervolga/optimize-cssnano-plugin@1.0.6
npm ERR!   node_modules/@intervolga/optimize-cssnano-plugin
npm ERR!     @intervolga/optimize-cssnano-plugin@"^1.0.5" from @vue/cli-service@3.12.1
npm ERR!     node_modules/@vue/cli-service
npm ERR!       dev @vue/cli-service@"^3.0.1" from the root project
npm ERR!   peer webpack@"^4.0.0 || ^5.0.0" from @soda/friendly-errors-webpack-plugin@1.8.1
npm ERR!   node_modules/@soda/friendly-errors-webpack-plugin
npm ERR!     @soda/friendly-errors-webpack-plugin@"^1.7.1" from @vue/cli-service@3.12.1
npm ERR!     node_modules/@vue/cli-service
npm ERR!       dev @vue/cli-service@"^3.0.1" from the root project
npm ERR!   20 more (@vue/cli-plugin-babel, @vue/cli-plugin-eslint, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! webpack-subresource-integrity@"^5.2.0-rc.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: webpack@5.89.0
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"^5.12.0" from webpack-subresource-integrity@5.2.0-rc.1
npm ERR!   node_modules/webpack-subresource-integrity
npm ERR!     webpack-subresource-integrity@"^5.2.0-rc.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! D:\nodejs\node_cache\_logs\2024-01-13T08_08_09_495Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: D:\nodejs\node_cache\_logs\2024-01-13T08_08_09_495Z-debug-0.log

 

执行npm install --legacy-peer-deps命令,后面加上--legacy-peer-deps,根据legacy中文含义“(软件或硬件)已过时但因使用范围广而难以替代的”可知就算peer的依赖没用满足条件也能安装,如下图最终安装成功:

PS E:\20231213\kuangshan\cepp_web_mine> npm install --legacy-peer-deps
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated sntp@1.0.9: 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.
npm WARN deprecated har-validator@4.2.1: this library is no longer supported
npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated eslint-loader@2.2.1: This loader has been deprecated. Please use eslint-webpack-plugin
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated cryptiles@2.0.5: 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 querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated boom@2.10.1: 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 @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated hoek@2.16.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 har-validator@5.1.5: this library is no longer supported
npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
npm WARN deprecated hawk@3.1.3: 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 axios@0.18.1: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated request@2.81.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated html-webpack-plugin@3.2.0: 3.x is no longer supported
npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated mkdirp@0.5.1: 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.)

added 1718 packages in 2m

99 packages are looking for funding
  run `npm fund` for details
PS E:\20231213\kuangshan\cepp_web_mine>