无法解决创建新角度项目的依赖树错误 [英] unable to resolve dependency tree error for creating new angular project
问题描述
所以今天我想使用命令 ng new
创建一个新的 Angular 项目,但我收到了这个错误:
so today I wanted to create a new Angular project using the command ng new <projectname>
and I got this error:
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: project-name@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
,再次安装了Angular cli
,再次下载并安装了node
,npm audit
,还有很多其他的事情,但什么也没发生.
I literally tried everything, I updated npm
, installed Angular cli
again, download and installed node
again, npm audit
, and a lot of other things but nothing happened.
此外,正如您所看到的,错误告诉我将命令与 --force
一起使用,我尝试过但没有任何反应,并且使用 --legacy-peer-deps
,我收到错误为未知选项.
Also as you can see error told me to use the command with --force
, I tried but nothing happened, and with --legacy-peer-deps
, I get the error as unknown option.
最让我烦恼的是昨晚一切正常,我什么都没做,但今天突然出现了这个错误.
What is bothering me the most is that everything was working completely right last night and I changed nothing at all but suddenly I'm getting this error today.
推荐答案
打开您使用 ng new 创建的文件夹并打开 package.json
文件.在 devDependencies
中更改jasmine-core"的版本;3.6.0
到 3.7.1
和karma-jasmine-html-reporter"从 1.5.0
到 1.6.0
并保存.然后返回终端并转到您的项目并运行 npm install
.现在它可以工作了,您可以运行 ng serve
.
Open the folder you create with ng new and open the package.json
file. In devDependencies
change the version of "jasmine-core" 3.6.0
to 3.7.1
and "karma-jasmine-html-reporter" from 1.5.0
to 1.6.0
and save it. Then go back to Terminal and go to your project and run npm install
. Now it works and you can run ng serve
.
这篇关于无法解决创建新角度项目的依赖树错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!