当您尝试通过 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.
Run Code Online (Sandbox Code Playgroud)
请帮助我,我不明白这里需要做什么
在我回答后几个小时,Angular 12 就发布了——它与 NPM 完美配合7.13.0。
您使用的是哪个 NPM 版本?
我刚刚使用 version 遇到了同样的问题7.10.0。降级到 后6.14.13,ng new按预期工作。
npm i -g npm@6.14.13
Run Code Online (Sandbox Code Playgroud)
目前,如果您想创建 Angular 项目,这似乎是最佳解决方案。不过, GitHub 上的相应问题已被关闭。所以我预计下一个 Angular 版本也能与最新的 NPM 版本一起使用。
我希望我能帮助你。
| 归档时间: |
|
| 查看次数: |
5624 次 |
| 最近记录: |