Why is npm attempting to use a package version not referenced in my package.json?

I’ve created an Angular + .NET 5 web application and am trying to run npm i to install the packages. When I do, I get this following error:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: <a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="89ebe8edeeece4e8e7e8eeece4ece7fda7e8ede4e0e7a7feecebfce0c9b9a7b9a7b9">[email protected]</a>
npm ERR! Found: @angular/<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c3a0acaeb3aaafa6b183f2f0edf1edf0">[email protected]</a>
npm ERR! node_modules/@angular/compiler
npm ERR!   @angular/<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a4c7cbc9d4cdc8c1d6e4">[email protected]</a>"13.2.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dfbcb0b2afb6b3baad9f">[email protected]</a>"13.2.5" from @angular/<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="75161a18051c1910075816191c3544465b475b40">[email protected]</a>
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   dev @angular/<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c3a0acaeb3aaafa6b1eea0afaa83">[email protected]</a>"^13.2.3" from the root project
npm ERR!   peer @angular/<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ed8e82809d8481889fc08e8184ad">[email protected]</a>"^13.0.0" from @angular-devkit/build-a<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="91fff6e4fdf0e3d1a0a2bfa3bfa4">[email protected]</a>
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="debcabb7b2baf3bfb0b9abb2bfac9e">[email protected]</a>"^13.2.4" 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.
npm ERR!
npm ERR! See C:Users...AppDataLocalnpm-cacheeresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:Users...AppDataLocalnpm-cache_logs2022-03-07T14_52_08_376Z-debug.log

As you can see from my package.json file below, I’m not referencing @angular/[email protected] or @angular-devkit/[email protected]. If I were to guess, it’s probably attempting to use the global cli version installed which is likely 13.2.5, but why would it completely ignore the one referenced in the package.json? Sure, I could use --force or --legacy-peer-deps, but am I really supposed to tell it to ignore dependencies when the correct dependencies are referenced in the package.json? It doesn’t make sense to me. I’ve done an npm cache clean --force, but that didn’t help. What’s the “correct” way to handle this scenario assuming I want to use this specific version?


  "name": "myapp",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "build:ssr": "ng run myapp:server:dev",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  "private": true,
  "dependencies": {
    "@angular/common": "13.2.3",
    "@angular/compiler": "13.2.3",
    "@angular/core": "13.2.3",
    "@angular/forms": "13.2.3",
    "@angular/platform-browser": "13.2.3",
    "@angular/platform-browser-dynamic": "13.2.3",
    "@angular/platform-server": "13.2.3",
    "@angular/router": "13.2.3",
    "bootstrap": "^4.6.0",
    "core-js": "^3.8.3",
    "jquery": "^3.5.1",
    "oidc-client": "^1.11.3",
    "popper.js": "^1.16.0",
    "rxjs": "^6.6.3",
    "zone.js": "0.11.4"
  "devDependencies": {
    "@angular-devkit/build-angular": "^13.2.4",
    "@angular/cli": "^13.2.4",
    "@angular/compiler-cli": "^13.2.3",
    "@angular/language-service": "^13.2.3",
    "@types/jasmine": "~3.4.4",
    "@types/jasminewd2": "~2.0.8",
    "@types/node": "~12.11.6",
    "codelyzer": "^6.0.2",
    "ini": "^1.3.7",
    "jasmine-core": "3.8",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^6.3.16",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.5.4",
    "typescript": "4.5.5"
  "optionalDependencies": {
    "node-sass": "^7.0.1",
    "protractor": "^7.0.0",
    "ts-node": "~8.4.1",
    "tslint": "^6.1.0"
  "resolutions": {
    "url-parse": ">=1.5.0",
    "lodash": ">=4.17.21"


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Looks like it is because of the caret ^ which will try to get the minor release. Try by removing the package-lock.json & remove the caret before the version number.

Alternatively you can also try yarn install

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x