npm install:Could not resolve dependency:peer... 原因和解决方案

这篇具有很好参考价值的文章主要介绍了npm install:Could not resolve dependency:peer... 原因和解决方案。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

电脑npm install报错; 报错日志如下:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @vue/eslint-config-standard@6.1.0
npm ERR! Found: eslint-plugin-vue@8.7.1
npm ERR! node_modules/eslint-plugin-vue
npm ERR!   dev eslint-plugin-vue@"^8.0.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR! node_modules/@vue/eslint-config-standard
npm ERR!   dev @vue/eslint-config-standard@"^6.1.0" from the root project
npm ERR!
npm ERR! node_modules/eslint-plugin-vue
npm ERR!   peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR!   node_modules/@vue/eslint-config-standard
npm ERR!     dev @vue/eslint-config-standard@"^6.1.0" 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! See C:\Users\AB123\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\AB123\AppData\Local\npm-cache\_logs\2023-01-24T03_08_49_805Z-debug-0.log

上述报错日志中有个关键字眼:this command with --force, or --legacy-peer-deps

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:何时使用--force--legacy-peer-deps
--force 会无视冲突,并强制获取远端npm库资源,即使本地有资源也会覆盖掉
--legacy-peer-deps:安装时忽略所有peerDependencies,忽视依赖冲突,已有的依赖不会覆盖,。
建议用--legacy-peer-deps 比较保险一点,反正我用了就安装成功了;


比如原本的命令为 npm i vuex-persistedstate 。改为npm i vuex-persistedstate --legacy-peer-deps即可。其余同样如此文章来源地址https://www.toymoban.com/news/detail-542434.html

到了这里,关于npm install:Could not resolve dependency:peer... 原因和解决方案的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包赞助服务器费用

相关文章

  • npm ERR! code ERESOLVEnpm ERR! ERESOLVE could not resolve dependency

    使用命令安装 npm 包时,我收到这些异常。 如何解决 ERESOLVE 无法解决安装 npm 包时的依赖关系树错误 错误? 要解决 ERESOLVE 安装 npm 包时无法解决依赖关系树错误,您有 依赖关系冲突 ( 不正确 且可能 损坏 的依赖关系),如它所说,因此请尝试使用 或 运行命令。如果它没有

    2024年02月08日
    浏览(39)
  • npm install出现npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve

    PS E:myvuebookshop npm i npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR!  npm ERR! While resolving: @vue/eslint-config-standard@6.1.0 npm ERR! Found: eslint-plugin-vue@8.7.1 npm ERR! node_modules/eslint-plugin-vue npm ERR!   dev eslint-plugin-vue@\\\"^8.0.3\\\" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! p

    2024年02月11日
    浏览(42)
  • ERESOLVE overriding peer dependency npm install错误

    错误提示 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 i --legacy-peer-deps –legacy-peer-deps命令用于绕过peerDependency里依赖的自动安装;它告诉npm忽略项

    2024年04月22日
    浏览(11)
  • npm install报错unable to resolve dependency tree

    npm install报错unable to resolve dependency tree

    一、问题背景 npm install安装项目依赖时报错 解决:npm install --legacy-peer-deps 其实提示上有:npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps 二、什么是peerDependency? 在日常使用命令 npm install / npm install XX 下载依赖的操作中,如果你使用的

    2023年04月26日
    浏览(14)
  • Could not resolve dependencies for project

    Could not resolve dependencies for project

    maven 打包Could not resolve dependencies for project和无效的目标发行版: 1.8 1.maven 打包Could not resolve dependencies for project 最近项目上使用的是idea ide的多模块话,需要模块之间的依赖,比如说系统管理模块依赖授权模块进行认证和授权,而认证授权模块需要依赖系统管理模块进行,然后

    2024年02月08日
    浏览(13)
  • Maven编译报错:Could not resolve dependencies for project

    编译项目时 出现报错: Failed to execute goal on project xxx-mybatis: Could not resolve dependencies for project com.xxx:xxx-mybatis:jar:0.0.1-SNAPSHOT: Could not transfer artifact org.mybatis:mybatis:jar:3.4.5 from/to central ( https://repo.maven.apache.org/maven2): GET request of: org/mybatis/mybatis/3.4.5/mybatis-3.4.5.jar from central failed: Pr

    2024年02月03日
    浏览(40)
  • 【npm】npm install命令报错npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree

    一、现象: npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree 二、原因 ERESOLVE与npm@7有关的问题很常见,因为npm7.x对某些事情比npm6.x更严格。通常,最简单的解决方法是将–legacy-peer-deps标志传递给npm(e.g.,npm i --legacy-peer-deps),或者使用npm@6。 如果这不能立即起作用,

    2024年02月04日
    浏览(43)
  • npm ERR! ERESOLVE could not resolve

    问题产生的原因和如何解决,其实npm已经列在了最后: 问题原因是依赖冲突导致不能下载依赖包(dependency conflict), 因为npm版本升级(version7), npmV7之前的版本遇到依赖冲突会忽视依赖冲突,继续进行安装, npmV7版本开始不会自动进行忽略,需要用户手动输入命令。 解决

    2024年02月15日
    浏览(37)
  • npm ERR code ERESOLVE ;npm ERRERESOLVE could not resolve

    安装 npm 插件时出现错误 报错的原因可能是 : npm 版本问题, npm 的不同版本对不同的组件库等命令不兼容,对命令的要求更严格; 最简单的解决方法是将 --legacy-peer-deps 标志传递给 npm ,解决指令例如:

    2024年02月15日
    浏览(38)
  • npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve

    npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve

     有很多类似这样的异常,而我统一叫npm报错 ERESOLVE 解决方案: npm 配置集旧版-对等-对等值设置为 true 后边继续执行npm安装插件操作  当然还有一个类似的 解决方案 ,就是在里 安装插件的命令后面加上 我举个例子,安装axios 这个是我没试过的,但是第一个解决方案一个道

    2024年02月14日
    浏览(39)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包