. Advertisement .
..3..
. Advertisement .
..4..
The error: “When I run ng new npm ERR! ERESOLVE unable to resolve dependency tree” is a common error that can show up in many ways. In this blog, we will go through some of the ways you can fix this issue. Read on.
When Does The Error: “When I run ng new npm ERR! ERESOLVE unable to resolve dependency tree” Happen?
In the terminal, I merely typed ng new. An npm error has occurred.
⠸ Installing packages (npm)...npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
When conflicting peerDependencies are encountered, npm install will by default fail in the most recent version of the software (v7). Since npm versions 3 to 6 ignored peerDependencies when eventually constructing a package tree, this problem was not present in those versions.
How To Solve The Error: “When I run ng new npm ERR! ERESOLVE unable to resolve dependency tree”?
Approach 1: Adjust “jasmine-core”: “~3.7.0” to “jasmine-core”: “~3.8.0”
To fix the error “When I run ng new npm ERR! ERESOLVE unable to resolve dependency tree”, you have to adjust “jasmine-core”: “~3.7.0” to “jasmine-core”: “~3.8.0”. Let’s follow these steps to do that:
- Access your package.json.
- Simply change “jasmine-core“: “~3.7.0” to “jasmine-core”: “~3.8.0” on the line.
- Next, run npm install manually and it should work.
- You will now be able to completely run ng serve –open from the same directory.
After finishing above steps, your error is completely resolved.
Approach 2: Not pay attention to the peerDependencies
Another way to solve your problem is that you don’t need pay attention to the peerDependencies.
Npm install should be given the extra parameter -legacy-peer-deps. The —legacy-peer-deps flag instructs npm to disregard the peer dependencies and continuously carry out the package installation.
To install the dependencies for your project, let’s try the command below:
npm install --save --legacy-peer-deps
Let’s run the following command if you want to set this permanently in the way supplement this into a configuration:
npm config set legacy-peer-deps true
However, in this method, the peer dependencies won’t be set up by default, even if you are utilizing the newest version of NPM.
Conclusion
We hope you enjoyed our article about the error. With this knowledge, we know that you can fix your error: “When I run ng new npm ERR! ERESOLVE unable to resolve dependency tree” quickly by following these steps! If you still have any other questions about fixing this syntax error, please leave a comment below. Thank you for reading!
Read more
Leave a comment