微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在创建新的 angular 项目时修复上游依赖冲突

如何解决在创建新的 angular 项目时修复上游依赖冲突

版本:
角 CLI:12.1.1
节点:14.17.3
包管理器:npm 7.19.1

创建新的 Angular 项目时出错。

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: angular-beginner@0.0.0
npm ERR! Found: jasmine-core@3.7.1
npm ERR! node_modules/jasmine-core
npm ERR!   dev jasmine-core@"~3.7.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer jasmine-core@">=3.8" from karma-jasmine-html-reporter@1.7.0
npm ERR! node_modules/karma-jasmine-html-reporter
npm ERR!   dev karma-jasmine-html-reporter@"^1.5.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.

搜索 StackOverflow 后,我找到了这个并尝试了。

  1. 使用 --force 或 --legacy-peer-deps 运行命令
  2. npm uninstall –g @angular/CLI
    npm 缓存清理 --force
    npm install –g @angular/cli@latest

但是还是没有解决问题。 TIA

解决方法

我在降级 nodenpm 版本时解决了这个问题,看来问题出在 npm 7 上。

Angular CLI: 12.1.1
Node: 14.16.1
Package Manager: npm 6.14.12
,

已解决

npm 版本 7 有一些问题。我已将 npm 版本降级为 6。 它正在运行。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。