MrBigLike
MrBigLike

Reputation: 1

Issues installing Angular with existing project

I'm new to Angular and am trying to setup my dev environment. My Win10 machine has NodeJS v16.2 installed. I'm also using VSCode.

I cloned an existing Angular web project that uses Angular Core 14.0.0 from a git repo. Using the NodeJS command prompt, I navigated into the Angular project folder and tried the command npm install. I got the error below and I think its saying I already have Angular 14.3.0 installed. I however uninstalled it, so I'm not sure what the issue is.

npm resolution error report

While resolving: @angular/[email protected] Found: @angular/[email protected] node_modules/@angular/core @angular/core@"^14.0.0" from the root project peer @angular/core@"14.3.0" from @angular/[email protected] node_modules/@angular/animations @angular/animations@"^14.0.0" from the root project peer @angular/animations@"^14.0.0 || ^15.0.0" from @angular/[email protected] node_modules/@angular/material @angular/material@"^14.2.5" from the root project peerOptional @angular/animations@"14.3.0" from @angular/[email protected] node_modules/@angular/platform-browser @angular/platform-browser@"^14.0.0" from the root project peer @angular/platform-browser@"14.3.0" from @angular/[email protected] node_modules/@angular/forms @angular/forms@"^14.0.0" from the root project peer @angular/forms@"^14.0.0 || ^15.0.0" from @angular/[email protected] node_modules/@angular/material @angular/material@"^14.2.5" from the root project peer @angular/forms@">=14.1.0" from [email protected] node_modules/ngx-editor ngx-editor@"^15.3.0" from the root project peer @angular/platform-browser@"^14.0.0 || ^15.0.0" from @angular/[email protected] node_modules/@angular/material @angular/material@"^14.2.5" from the root project peer @angular/platform-browser@"14.3.0" from @angular/[email protected] node_modules/@angular/platform-browser-dynamic @angular/platform-browser-dynamic@"^14.0.0" from the root project peer @angular/platform-browser@"14.3.0" from @angular/[email protected] node_modules/@angular/router @angular/router@"^14.0.0" from the root project peer @angular/platform-browser@">=14.1.0" from [email protected] node_modules/ngx-editor ngx-editor@"^15.3.0" from the root project peer @angular/core@"^14.0.0 || ^15.0.0" from @angular/[email protected]
node_modules/@angular/cdk

Fix the upstream dependency conflict, or retry this command with --force, or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.

Raw JSON explanation object:

{ "code": "ERESOLVE", "edge": { "type": "peer", "name": "@angular/core", "spec": "7.2.16", "error": "INVALID", "from": { "name": "@angular/http", "version": "7.2.16", "location": "node_modules/@angular/http", "isWorkspace": false, "dependents": [ { "type": "prod", "name": "@angular/http", "spec": "^7.2.16", "from": { "location": "C:\git\WebApp\UI" } } ] } },

I tried uninstalling Angular/CLI using npm uninstall -g @angular/cli

I also tried a npm cache clean --force and npm cache verify.

I checked my windows appdata folder and deleted any Angular folders.

I've tried installing Angular 14.0.0 to match the project, but I still get the same error.

If I create a brand new project everything works fine.

Upvotes: 0

Views: 233

Answers (2)

Yehan Yeshminda
Yehan Yeshminda

Reputation: 35

Try to clear the cache of the NPM using npm cache clean --force

Or you can try to delete the node_modules and then do npm i again maybe that might work.

Upvotes: 0

1- install npm-check-updates globally

npm install -g npm-check-updates

2- update package.json

ncu -u

3- install packages

npm install --force

Upvotes: 0

Related Questions