. Advertisement .
..3..
. Advertisement .
..4..
The error: “Unable to resolve dependency tree error for creating new angular project” 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: “Unable to resolve dependency tree error for creating new angular project” Happen?
When attempting to build a new Angular project using the ng new YiloYilo command, you may receive the following error:
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.
You have encounter the error “Unable to resolve dependency tree error for creating new angular project” because of the versions of jasmine-core and karma-jasmine-html-reporter. They are producing this error.
How To Solve The Error: “Unable to resolve dependency tree error for creating new angular project”?
Approach 1: Simply follow these instructions
Perhaps there is a problem with the current NPM 7.12.0 and Node 16.1.0. There is a great solution for you to solve the error “Unable to resolve dependency tree error for creating new angular project”.
Simply follow these instructions to understand more about this method:
1. Remove Node.
You have to remove Node because the shell can become confused about which Node to utilize. Of course, you may change your shell configuration so that it checks for Node installed from nvm first, but it would be an extra step that isn’t essential, and your old Node distribution is no longer supported on your disk, it is outdated.
2. Install the most recent Node version again (LTS: 14.16.1)
Mac/Ubuntu Linux:
Version-management becomes simpler with the module n
:
npm install n -g
For the newset stable version:
n stable
For the most recent version:
n latest
Windows:
You just install node again from the .msi in Windows from the node website.
3. Start ng new my-app.
After doing these steps, your error will be completely solved.
Approach 2: Update “jasmine-core” and “karma-jasmine-html-reporter”
The issue is that the versions of jasmine-core and karma-jasmine-html-reporter are producing this error. The approach is to update “jasmine-core” from 3.6.0 to 3.7.1 and “karma-jasmine-html-reporter” from 1.5.0 to 1.6.0, then save.
Follow the instructions below:
- Access the project folder
- Next, you’ll need to access the package.json file
- Modify the version of both Dependencies below in devDependencies
- Modify “jasmine-core” version 3.6.0 to 3.7.1, and “karma-jasmine-html-reporter” version 1.5.0 to 1.6.0
- Save the package.json file
- In the project, access the terminal
- Use npm install
- It now works, and ng serve may be used
Conclusion
We hope you enjoyed our article about the error. With this knowledge, we know that you can fix your error: “Unable to resolve dependency tree error for creating new angular project” 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
→ Solve The Error: “Unable to resolve dependency tree Reactjs”
Leave a comment