0

npm install fail with below dependency "@angular-devkit/build-angular" : sample package.json

  {
  "name": "myApp",
  "version": "0.0.1",
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1000.0"
  }
}

I am using node V15.5.1 npm v7.3.0

I'm getting below errors :

npm ERR! Found: [email protected] npm ERR! node_modules/typescript npm ERR! peer typescript@">=3.9 <4.1" from @angular/[email protected] npm ERR! node_modules/@angular/compiler-cli npm ERR! peer @angular/compiler-cli@">=10.0.0-next.0 < 11" from @angular-devkit/[email protected] npm ERR!
node_modules/@angular-devkit/build-angular npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer typescript@">=3.9 < 3.10" from @angular-devkit/[email protected] npm ERR! node_modules/@angular-devkit/build-angular

not sure why node/npm is looking for typescript 4.0.5 instead of the version that can suit both the ranges. (peer typescript@">=3.9 <4.1" and peer typescript@">=3.9 < 3.10" ) is this working as expected .

i can able to run the npm install with --legacy-peer-deps flag.

is this a problem or its working as designed . why cant npm choose the version which suits both cases

1 Answer 1

0

Use LTS version of node, currently 14.15.4. Changing the version depends on your OS and package manager, but at least on MacOS and Homebrew it goes like this:

brew update
brew install node@14
brew link --overwrite node@14
Sign up to request clarification or add additional context in comments.

2 Comments

thanks for your answer . i like to know is this the expected behaviour going forward in new releases, or some bug with npm.
Ah, ok I undestood that the question was "how to make it work". It certainly looks like a bug in npm to me and looks like someone (you?) has reported it: github.com/npm/cli/issues/2510 But in general I think it's a good idea to stick with LTS versions when doing angular development.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.