angularnpmangular8angular-compiler

Angular - 8 - Trouble with npm-install - Error


after moving my App to another computer I have trouble with runing npm-install. Here is a content of my package.json:

{
  "name": "lunaticgodsinfo",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "build:ssr": "ng run LunaticGodsInfo:server:dev",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "8.2.12",
    "@angular/common": "8.2.12",
    "@angular/compiler": "8.2.12",
    "@angular/core": "8.2.12",
    "@angular/forms": "8.2.12",
    "@angular/localize": "^9.1.13",
    "@angular/material": "^8.2.3",
    "@angular/platform-browser": "8.2.12",
    "@angular/platform-browser-dynamic": "8.2.12",
    "@angular/platform-server": "8.2.12",
    "@angular/router": "8.2.12",
    "@kolkov/angular-editor": "^1.0.3",
    "@nguniversal/module-map-ngfactory-loader": "8.1.1",
    "angular-froala-wysiwyg": "^4.0.2",
    "bootstrap": "^4.6.0",
    "core-js": "^3.8.3",
    "jquery": "^3.5.1",
    "less": "^3.9.0",
    "ngx-facebook": "^3.0.0-0",
    "ngx-simplemde": "^10.0.0",
    "oidc-client": "^1.11.3",
    "popper.js": "^1.16.0",
    "rxjs": "^6.6.3",
    "zone.js": "0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.803.29",
    "@angular/cli": "^8.3.29",
    "@angular/compiler-cli": "^8.2.14",
    "@angular/language-service": "^8.2.14",
    "@types/jasmine": "~3.4.4",
    "@types/jasminewd2": "~2.0.8",
    "@types/node": "~12.11.6",
    "codelyzer": "^5.2.2",
    "ini": "^1.3.7",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^5.2.3",
    "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": "3.5.3"
  },
  "optionalDependencies": {
    "node-sass": "^5.0.0",
    "protractor": "~5.4.2",
    "ts-node": "~8.4.1",
    "tslint": "~5.20.0"
  }
}

After running npm-install here goes the Error:

npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: lunaticgodsinfo@0.0.0
npm ERR! Found: @angular/compiler@8.2.12
npm ERR! node_modules/@angular/compiler
npm ERR!   @angular/compiler@"8.2.12" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@"8.2.14" from @angular/compiler-cli@8.2.14
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   dev @angular/compiler-cli@"^8.2.14" from the root project
npm ERR!   peer @angular/compiler-cli@"^8.0.0" from @angular-devkit/build-angular@0.803.29
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"^0.803.29" 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.

I tried running npm-install --legacy-peer-deps, but the command install Angular Version 14?? Instead of 8 and the app won't even run. Could someone help me understand what is causing the error? Thanks in advance.


Solution

  • Update: Problem Solved. Solved it by manually editing Angular packages to match:

    "@angular/compiler-cli": "^8.2.14"
    

    The Angular packages now looks like:

        "@angular/animations": "8.2.14",
        "@angular/common": "8.2.14",
        "@angular/compiler": "8.2.14",
        "@angular/core": "8.2.14",
        "@angular/forms": "8.2.14",
        "@angular/localize": "^9.1.13",
        "@angular/material": "^8.2.3",
        "@angular/platform-browser": "8.2.14",
        "@angular/platform-browser-dynamic": "8.2.14",
        "@angular/platform-server": "8.2.14",
        "@angular/router": "8.2.14",