【问题标题】:npm unable to resolve dependency tree when create a ionic app React创建离子应用程序时,npm 无法解析依赖关系树 React
【发布时间】:2021-05-07 21:09:03
【问题描述】:

我尝试删除所有 npm 包,卸载 ionic 和许多其他东西,但我无法传递此错误。 我什至验证了 typescript 和 react-script 的版本存在(就像在另一个不存在版本的帖子中一样)

完整日志:

λ ionic start myApp
? Framework: React
? Starter template: sidemenu
? .\myApp exists. Overwrite? Yes
√ Preparing directory .\myApp in 10.64ms
√ Downloading and extracting sidemenu starter in 830.02ms
> ionic integrations enable capacitor --quiet -- myApp io.ionic.starter
> npm.cmd i --save -E @capacitor/core
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: typescript@4.1.3
npm ERR! node_modules/typescript
npm ERR!   typescript@"4.1.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional typescript@"^3.2.1" from react-scripts@4.0.1
npm ERR! node_modules/react-scripts
npm ERR!   react-scripts@"4.0.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! See C:\Users\<user>\AppData\Local\npm-cache\eresolve-report.txt for a full report.
> npm.cmd i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: typescript@4.1.3
npm ERR! node_modules/typescript
npm ERR!   typescript@"4.1.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional typescript@"^3.2.1" from react-scripts@4.0.1
npm ERR! node_modules/react-scripts
npm ERR!   react-scripts@"4.0.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! See C:\Users\<user>\AppData\Local\npm-cache\eresolve-report.txt for a full report.

【问题讨论】:

    标签: reactjs ionic-framework npm


    【解决方案1】:

    事实上,我们需要使用--legacy-peer-deps,而不是尝试使用--force 命令大约10 次。也许武力在任何地方都不是好选择。

    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force, or --legacy-peer-deps
    

    【讨论】:

    • 抱歉,您是如何解决这个问题的?我也有同样的问题。
    • @stt106 我使用 npm i --legacy-peer-deps
    猜你喜欢
    • 2021-08-11
    • 1970-01-01
    • 2021-09-10
    • 2021-06-15
    • 2021-05-12
    • 1970-01-01
    • 2021-06-14
    • 2023-02-08
    • 1970-01-01
    相关资源
    最近更新 更多