首页IT科技npm install出现err(npm install出现npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve)

npm install出现err(npm install出现npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve)

时间2025-04-30 00:44:09分类IT科技浏览5476
导读:PS E:\myvue\bookshop> npm inpm ERR! code ERESOLVE...

PS E:\myvue\bookshop> npm inpm ERR! code ERESOLVEnpm ERR! ERESOLVE could not resolvenpm ERR! npm ERR! While resolving: @vue/eslint-config-standard@6.1.0npm ERR! Found: eslint-plugin-vue@8.7.1npm ERR! node_modules/eslint-plugin-vuenpm ERR!   dev eslint-plugin-vue@"^8.0.3" from the root projectnpm ERR!npm ERR! Could not resolve dependency:npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0npm ERR! node_modules/@vue/eslint-config-standardnpm ERR!   dev @vue/eslint-config-standard@"^6.1.0" from the root projectnpm ERR!npm ERR! Conflicting peer dependency: eslint-plugin-vue@7.20.0npm ERR! node_modules/eslint-plugin-vuenpm ERR!   peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0npm ERR!   node_modules/@vue/eslint-config-standardnpm ERR!     dev @vue/eslint-config-standard@"^6.1.0" from the root projectnpm ERR!npm ERR! Fix the upstream dependency conflict, or retrynpm ERR! this command with --force, or --legacy-peer-depsnpm ERR! to accept an incorrect (and potentially broken) dependency resolution.

只要在npm install后面加上--legacy-peer-deps就可以解决问题

PS E:\myvue\bookshop> npm i --legacy-peer-depsnpm 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

added 996 packages, and audited 997 packages in 11s

1 critical severity vulnerability

原因:

npm install xxxx --legacy-peer-deps命令可以这么理解            ,legacy的意思:遗产/(软件或硬件)已过时但因使用范围广而难以替代的;所以npm install xxxx --legacy-peer-deps命令就是用于绕过peerDependency这个依赖的自动安装                   ,peerDependency使得用户依赖的包版本与各个子项目依赖的包版本相互不兼容       ,那么就会报错(无法解析依赖树的问题(依赖冲突))让用户自行去修复            ,因而导致安装过程的中断             。(因为是从npm v7引入的                  ,因此npm v3-v6就不会发生这个错误);它告诉npm忽略项目中引入的各个依赖模块之间依赖相同但版本不同的问题       ,以npm v3-v6的方式去继续执行安装操作                   。所以其实该命令并没有真的解决冲突      ,而是忽略了冲突                  ,以“过时            ”(v3-v6)的方式进行下载操作      。

创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!

展开全文READ MORE
spiderman是什么意思网络用语(spider.py 0.5 : Python Package Index) threejs素材(THREE.js)