gpt4 book ai didi

javascript - 为什么 ng new newApp 生成无法解决依赖树错误

转载 作者:行者123 更新时间:2023-12-05 00:24:18 29 4
gpt4 key购买 nike

我正在尝试使用命令创建一个新的 Angular 应用程序 ng new app-name ..但是运行命令后,它在命令行中显示以下内容。

Installing packages (npm)...npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: angular-module@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.
npm ERR!
npm ERR! See /home/vazha/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/vazha/.npm/_logs/2021-05-07T05_12_55_121Z-debug.log
✖ Package install failed, see above.
The Schematic workflow failed. See above.
我们如何解决这个问题?

最佳答案

此错误是由 npm 7 问题引起的。 Angular 团队建议现在使用 npm 6。
运行npm install -g npm@6以确保您使用的是该版本。
另一种方法是运行 ng new--skipInstall标记,然后使用 npm install --legacy-peer-deps 安装依赖项.

关于javascript - 为什么 ng new newApp 生成无法解决依赖树错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62910471/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com