简体   繁体   English

Angular - 8 - npm-install 出现问题 - 错误

[英]Angular - 8 - Trouble with npm-install - Error

after moving my App to another computer I have trouble with runing npm-install.将我的应用程序移动到另一台计算机后,我无法运行 npm-install。 Here is a content of my package.json:这是我的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 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??我尝试运行 npm-install --legacy-peer-deps,但命令 install Angular Version 14?? Instead of 8 and the app won't even run.而不是 8,应用程序甚至不会运行。 Could someone help me understand what is causing the error?有人可以帮助我了解导致错误的原因吗? Thanks in advance.提前致谢。

Update: Problem Solved.更新:问题已解决。 Solved it by manually editing Angular packages to match:通过手动编辑 Angular 包来匹配解决它:

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

The Angular packages now looks like: Angular 封装现在看起来像:

    "@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",

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM