npm ERR! ERESOLVE unable to resolve dependency tree




Asked on December 13, 2023
I am installing Angular on my MacOS but not getting success.
I am getting following errors.

Installing packages (npm)...npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: my-app@0.0.0
npm ERR! Found: @angular/compiler@undefined
npm ERR! node_modules/@angular/compiler
npm ERR!   @angular/compiler@"^17.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@"17.0.6" from @angular/platform-browser-dynamic@17.0.6
npm ERR! node_modules/@angular/platform-browser-dynamic
npm ERR!   @angular/platform-browser-dynamic@"^17.0.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.



Replied on December 13, 2023
Follow the steps.

Step-1: Update node. Run following commands.

a.
sudo npm cache clean -f

b.
sudo npm install -g n

c.
sudo n stable

Step-2: Uninstall and Install Angular

a.
sudo npm uninstall -g @angular/cli

b.
sudo npm install -g @angular/cli

c.
ng new myApp

d. Go to myApp directory and run below command.

sudo npm install --force



Replied on December 13, 2023
Thanks. Working.


Write Answer











©2024 concretepage.com | Privacy Policy | Contact Us