angular - ERESOLVE 无法解析依赖树?
问题描述
当您尝试通过 Angular cli 创建 Angular 项目时,您会收到此错误
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: animation@0.0.0
npm ERR! Found: jasmine-core@3.6.0
npm ERR! node_modules/jasmine-core
npm ERR! dev jasmine-core@"~3.6.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer jasmine-core@">=3.7.1" from karma-jasmine-html-reporter@1.6.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.
请帮帮我,我不明白这里需要做什么
解决方案
更新(Angular 12.0.0)
在我回答后几个小时,Angular 12 就发布了——它与 NPM 完美配合7.13.0
。
原始答案(Angular 11.2.11)
您使用的是哪个 NPM 版本?
我刚刚使用 version 遇到了同样的问题7.10.0
。降级到 后6.14.13
,ng new
按预期工作。
npm i -g npm@6.14.13
目前,如果你想创建一个 Angular 项目,这似乎是最好的解决方案。但是, GitHub 上的相应问题已经关闭。所以我希望下一个 Angular 版本也可以与最新的 NPM 版本一起使用。
我希望我能帮助你。
推荐阅读
- python-3.x - 无法在 Windows Server 2012R2 中使用 Python Watch Dog 库监控网络存储位置(网络共享路径)
- java - 如何使用 Room for Android 重新声明 @Embedded 的索引?
- sql - 如何连接 year =2019 和 period=6 给出 20106 而不是 20196 数字和 year =2018 , period=3112 给出 20183112
- python - 截止日期前的Django过滤日期
- r - 在data.table中使用滚动函数计算点之间的欧几里得距离
- android - 在 Android Studio 中以离线模式编译时无法解析播放服务
- node.js - NodeJs Express:无法发布请求
- wordpress - 我无法使用 xampp 打开我的管理面板
- laravel - Laravel FormRequest:客户端发送带有点的属性
- riscv - 如何在gem5上模拟riscv32?