冲突的对等依赖关系:@angular/compiler@15.0.0

huangapple go评论74阅读模式
英文:

Conflicting peer dependency: @angular/compiler@15.0.0

问题

I think the issue you're facing is related to a dependency conflict with the @angular-devkit/build-angular package. The error message suggests that it's having trouble resolving the correct version of @angular/compiler-cli. You mentioned trying various solutions like updating versions and using --legacy-peer-deps, but none worked.

It's important to note that as of my last knowledge update in September 2021, these specific package versions might have changed, and new updates or fixes could have been released.

However, in general, when you encounter such dependency conflicts, you can try the following steps:

  1. Check Angular Versions: Ensure that the versions of Angular packages in your package.json file are compatible with each other. Make sure they are all from the same major version (e.g., Angular 10 or Angular 15).

  2. Remove node_modules and package-lock.json: Delete the node_modules directory and the package-lock.json file in your project folder. Then, run npm install to reinstall the dependencies.

  3. Clear NPM Cache: Sometimes, cached data can cause issues. You can clear the npm cache by running npm cache clean -f and then running npm install again.

  4. Peer Dependency Issue: If you're using a package that relies on a different version of @angular/compiler-cli than what your project needs, you might need to contact the package maintainer or consider using a different version of that package.

  5. Manual Dependency Resolution: If the issue persists, you might need to manually specify versions of conflicting dependencies in your package.json. This can be a bit tricky and requires understanding the compatibility between different versions.

Remember to consult the documentation and release notes for the specific versions of Angular and the packages you are using, as newer versions may have introduced changes or fixes to dependency issues.

Please note that the information provided is based on my knowledge as of September 2021, and there may have been updates or changes since then.

英文:

I'm trying to add android to my Ionic proyect, but when I run the code, I have this issue:

Error:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @angular-devkit/build-angular@15.2.6
npm ERR! Found: @angular/compiler-cli@10.2.5
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   dev @angular/compiler-cli@"^10.2.5" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler-cli@"^15.0.0" from @angular-devkit/build-angular@15.2.6  
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR!   dev @angular-devkit/build-angular@"^15.0.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @angular/compiler-cli@15.2.9
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   peer @angular/compiler-cli@"^15.0.0" from @angular-devkit/build-angular@15.2.6
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"^15.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:\Users\Usuario\AppData\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:\Users\Usuario\AppData\Local\npm-cache\_logs23-06-29T09_48_21_482Z-debug-0.log

package.json:

"dependencies": {
    "@angular/common": "^15.0.0",
    "@angular/core": "^15.0.0",
    "@angular/forms": "^15.0.0",
    "@angular/platform-browser": "^15.0.0",
    "@angular/platform-browser-dynamic": "^15.0.0",
    "@angular/router": "^15.0.0",
    "@awesome-cordova-plugins/calendar": "^6.3.0",
    "@capacitor/app": "4.1.1",
    "@capacitor/core": "4.7.3",
    "@capacitor/geolocation": "^5.0.2",
    "@capacitor/haptics": "4.1.0",
    "@capacitor/keyboard": "4.1.1",
    "@capacitor/status-bar": "4.1.1",
    "@fullcalendar/angular": "^6.1.7",
    "@fullcalendar/bootstrap5": "^6.1.7",
    "@fullcalendar/core": "^6.1.7",
    "@fullcalendar/daygrid": "^6.1.7",
    "@fullcalendar/interaction": "^6.1.7",
    "@fullcalendar/list": "^6.1.7",
    "@fullcalendar/timegrid": "^6.1.7",
    "@ionic/angular": "^7.0.2",
    "@ionic/vue": "^7.0.2",
    "@ionic/vue-router": "^7.0.2",
    "@swimlane/ngx-datatable": "^20.1.0",
    "bootstrap": "^5.2.3",
    "bootstrap-icons": "^1.10.5",
    "cordova-plugin-calendar": "^5.1.6",
    "install": "^0.13.0",
    "ionicons": "^7.0.0",
    "jquery": "^3.6.4",
    "npm": "^9.6.4",
    "rxjs": "~7.5.0",
    "swiper": "^9.2.3",
    "tslib": "^2.3.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^15.0.0",
    "@angular-eslint/builder": "^15.0.0",
    "@angular-eslint/eslint-plugin": "^15.0.0",
    "@angular-eslint/eslint-plugin-template": "^15.0.0",
    "@angular-eslint/schematics": "^15.0.0",
    "@angular-eslint/template-parser": "^15.0.0",
    "@angular/cli": "^15.0.0",
    "@angular/compiler": "^15.0.0",
    "@angular/compiler-cli": "^10.2.5",
    "@angular/language-service": "^15.0.0",
    "@capacitor/cli": "4.7.3",
    "@ionic/angular-toolkit": "^9.0.0",
    "@types/jasmine": "~4.0.0",
    "@types/node": "^12.11.1",
    "@typescript-eslint/eslint-plugin": "5.3.0",
    "@typescript-eslint/parser": "5.3.0",
    "eslint": "^7.6.0",
    "eslint-plugin-import": "^2.27.5",
    "eslint-plugin-jsdoc": "30.7.6",
    "eslint-plugin-prefer-arrow": "1.2.2",
    "jasmine-core": "~4.3.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "^1.1.2",
    "karma-coverage-istanbul-reporter": "^3.0.1",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "ts-node": "~8.3.0",
    "typescript": "~4.8.4",
    "webpack": "^5.79.0",
    "webpack-cli": "^5.0.1"
  },
  "overrides": {
    "xml2js": "^0.5.0"
  }

I think the issue is that I have an old version of compiler-cli, but I tried to update, uninstall and install, and nothing works.

I tried to do all the thing that I saw on web, like update all the versions, or install --legacy-peer-deps, but none of this has succeed.

¿Any idea? Thanks.

答案1

得分: 1

已解决。

我只需更新@angular-eslint/schematics,所有编译器依赖项都会得到更新。

首先运行ng update,然后运行ng update @angular-eslint/schematics,问题都解决了。

英文:

SOLVED.

Al I have to do is update @angular-eslint/schematics and all the compiler dependencies are updated.

First I run ng update and then ng update @angular-eslint/schematics and all solved.

答案2

得分: 0

Your @angular/compiler-cli dependence is outdated (^10.2.5) it should be ^15.0.0.

英文:

Your @angular/compiler-cli dependence is outdated (^10.2.5) it should be ^15.0.0

huangapple
  • 本文由 发表于 2023年6月29日 17:40:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/76579874.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定