Reputation: 211
When you try to create an angular project via the angular cli, you get this error
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
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 [email protected]
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.
please help me, I don't understand what needs to be done here
Upvotes: 3
Views: 5880
Reputation: 1052
Although downgrading to an older version of npm works, I would not recommend that because they updated it for a reason.
The new version can have included critical patches to security holes, or they can have included new or enhanced features.
So, here is my solution:
Notice what angular says:
npm ERR! Could not resolve dependency:
npm ERR! peer jasmine-core@">=3.7.1" from [email protected]
So, you need to open your package.json
file and change jasmine-core
version from 3.6.0
to 3.7.1
which is the version that angular angular found in [email protected]
.
Then delete the package-lock.json
file and run npm install
.
Upvotes: 1
Reputation: 121
Just a few hours after my answer, Angular 12 was released - which works perfectly with NPM 7.13.0
.
Which NPM version are you using?
I just faced the same problem using version 7.10.0
. After downgrading to 6.14.13
, ng new
worked as expected.
npm i -g [email protected]
Currently, this seems to be the best solution if you want to create an Angular project. However, the respective Issue on GitHub has already been closed. So I expect the next Angular release to also work with the latest NPM version.
I hope I could help you.
Upvotes: 6