Home > database >  Error after npm install Could not resolve dependency
Error after npm install Could not resolve dependency

Time:09-22

After do a git clone im getting this error with my project after npm install:

npm ERR! code ERESOLVE
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/zone.js
npm ERR!   zone.js@"0.10.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! node_modules/@angular/core
npm ERR!   @angular/core@"10.0.0" from the root project
npm ERR!   peer @angular/core@"10.0.0" from @angular/[email protected]
npm ERR!   node_modules/@angular/animations
npm ERR!     @angular/animations@"10.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.
npm ERR!
npm ERR! See C:\..\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\..\Local\npm-cache\_logs\2021-09-19T20_20_14_157Z-debug.log

This is my complete package.json file:

{
  "name": "app-frontend",
  "version": "1.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "dev": "ng serve -c dev --watch=false",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "10.0.0",
    "@angular/cdk": "10.1.3",
    "@angular/common": "10.0.0",
    "@angular/compiler": "10.0.0",
    "@angular/core": "10.0.0",
    "@angular/forms": "10.0.0",
    "@angular/platform-browser": "10.0.0",
    "@angular/platform-browser-dynamic": "10.0.0",
    "@angular/router": "10.0.0",
    "@fortawesome/fontawesome-free": "5.14.0",
    "@fullcalendar/core": "5.2.1",
    "@maestro-ng/core": "https://nexus.org.br/repository/npm-all/@maestro-ng/core/-/core-1.10.0.tgz",
    "@maestro-ng/primeng": "https://nexus.org/repository/npm-all/@maestro-ng/primeng/-/primeng-1.10.0.tgz",
    "@types/pdfjs-dist": "0.1.2",
    "bootstrap": "4.1.3",
    "chart.js": "2.7.2",
    "core-js": "3.6.5",
    "g": "2.0.1",
    "jquery": "3.5.1",
    "js-base64": "2.4.3",
    "moment": "2.27.0",
    "ng2-currency-mask": "9.0.2",
    "ng2-pdfjs-viewer": "5.0.7",
    "ngx-moment": "5.0.0",
    "pdfjs-dist": "1.10.88",
    "popper.js": "1.14.4",
    "primeflex": "2.0.0",
    "primeicons": "4.0.0",
    "primeng": "9.1.3",
    "quill": "1.3.7",
    "rxjs": "6.6.2",
    "simple-pdf-viewer": "2.0.3",
    "tslib": "2.0.0",
    "zone.js": "0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.1000.5",
    "@angular/cli": "10.0.5",
    "@angular/compiler-cli": "10.0.0",
    "@angular/language-service": "10.0.0",
    "@fortawesome/fontawesome-free": "5.8.2",
    "@types/jasmine": "2.8.12",
    "@types/jasminewd2": "2.0.8",
    "@types/node": "12.11.1",
    "codelyzer": "6.0.0",
    "jasmine-core": "3.5.0",
    "jasmine-spec-reporter": "5.0.0",
    "karma": "5.0.0",
    "karma-chrome-launcher": "3.1.0",
    "karma-cli": "1.0.1",
    "karma-coverage-istanbul-reporter": "3.0.2",
    "karma-jasmine": "3.3.0",
    "karma-jasmine-html-reporter": "1.5.0",
    "protractor": "7.0.0",
    "ts-node": "8.10.2",
    "tslint": "6.1.0",
    "tslint-eslint-rules": "5.4.0",
    "typescript": "3.9.7"
  }
}

I don't have sure if its a problem with my local, or its a problem with master branch, because i just have cloned the project after delete them. Im trying to prepare the project to update to angular 12 How i can solve this error?

CodePudding user response:

From what I can see from your package file, no updates to Angular 12 happened. You are still running angular 10. In my experience the issue can be due to a mix of mis-configuration locally within the project. My best guess would be to reinstall the correct version of angular. You can follow this guide that could help you: https://update.angular.io/

CodePudding user response:

Checking the errors i start to update some packages and put the "^" symbol

    {
  "name": "codex-frontend",
  "version": "1.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "dev": "ng serve -c dev --watch=false",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^10.0.0",
    "@angular/cdk": "^10.2.7",
    "@angular/common": "^10.2.5",
    "@angular/compiler": "^10.2.5",
    "@angular/core": "^10.0.7",
    "@angular/forms": "^10.0.0",
    "@angular/platform-browser": "^10.2.5",
    "@angular/platform-browser-dynamic": "^10.0.0",
    "@angular/router": "^10.0.0",
    "@fortawesome/fontawesome-free": "5.14.0",
    "@fullcalendar/core": "5.2.1",
    "@maestro-ng/core": "https://nexus.org.br/repository/npm-all/@maestro-ng/core/-/core-1.10.0.tgz",
    "@maestro-ng/primeng": "https://nexus.org.br/repository/npm-all/@maestro-ng/primeng/-/primeng-1.10.0.tgz",
    "@types/pdfjs-dist": "0.1.2",
    "bootstrap": "4.1.3",
    "chart.js": "2.7.2",
    "core-js": "3.6.5",
    "g": "2.0.1",
    "jquery": "3.5.1",
    "js-base64": "2.4.3",
    "moment": "2.27.0",
    "ng2-pdfjs-viewer": "^6.0.2",
    "ngx-moment": "5.0.0",
    "pdfjs-dist": "1.10.88",
    "popper.js": "1.14.4",
    "primeflex": "2.0.0",
    "primeicons": "4.0.0",
    "primeng": "^10.0.3",
    "quill": "1.3.7",
    "rxjs": "6.6.2",
    "simple-pdf-viewer": "2.0.3",
    "tslib": "2.0.0",
    "zone.js": "0.10.3"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.1000.8",
    "@angular/cli": "10.0.5",
    "@angular/compiler-cli": "^10.0.0",
    "@angular/language-service": "10.0.0",
    "@fortawesome/fontawesome-free": "5.8.2",
    "@types/jasmine": "2.8.12",
    "@types/jasminewd2": "2.0.8",
    "@types/node": "12.11.1",
    "codelyzer": "6.0.0",
    "jasmine-core": "3.5.0",
    "jasmine-spec-reporter": "5.0.0",
    "karma": "5.0.0",
    "karma-chrome-launcher": "3.1.0",
    "karma-cli": "1.0.1",
    "karma-coverage-istanbul-reporter": "3.0.2",
    "karma-jasmine": "3.3.0",
    "karma-jasmine-html-reporter": "1.5.0",
    "protractor": "7.0.0",
    "ts-node": "8.10.2",
    "tslint": "^5.4.0",
    "tslint-eslint-rules": "^5.4.0",
    "typescript": "3.9.7"
  }
}

until its solve. I needed to uninstall the angular too, like this question Thanks

  • Related