【问题标题】:"Could not resolve dependency," error when running "vue upgrade"运行“vue 升级”时出现“无法解决依赖关系”错误
【发布时间】:2021-10-12 17:49:44
【问题描述】:

我正在尝试使用说明 here 来安装 Vue 3 的迁移版本。

当我告诉你运行vue upgrade 我选择y 来安装升级然后它给了我以下错误

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: ed_editor@0.1.0
npm ERR! Found: vue@2.6.14
npm ERR! node_modules/vue
npm ERR!   vue@"^2.6.11" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"3.1.5" from @vue/compiler-sfc@3.1.5
npm ERR! node_modules/@vue/compiler-sfc
npm ERR!   peer @vue/compiler-sfc@"^3.0.0-beta.14" from @vue/cli-service@4.5.13
npm ERR!   node_modules/@vue/cli-service
npm ERR!     dev @vue/cli-service@"~4.5.13" 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\Zach\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\Zach\AppData\Local\npm-cache\_logs\2021-08-08T22_29_19_955Z-debug.log
 ERROR  command failed: npm install --loglevel error @vue/cli-service@~4.5.13

我已阅读错误消息,但我不确定如何解决该问题。我尝试使用--force,但它似乎只会在以后引起更多问题。

我将如何解决这个问题?

【问题讨论】:

    标签: vue.js npm vuejs3


    【解决方案1】:

    您可能使用的是 npm 版本 7。(使用 npm 版本 7,我能够根据您的错误消息复制您的错误。)最简单的解决方案是:

    • 使用npm--legacy-peer-deps标志
    • 使用npm第6版(npm第7版的--legacy-peer-deps标志的行为是默认的)

    教程和软件包可能是使用npm 版本 6(或者可能是 5 或 4)编写和测试的。许多现有项目在 npm 版本 7 中遇到此 ERESOLVE 错误,因为该版本开始将对等依赖问题视为错误,而不是可以忽略的建议问题。

    【讨论】:

      猜你喜欢
      • 2022-06-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-08
      • 2022-11-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多