manfredsteyer / ngx-build-plus

Extend the Angular CLI's default build behavior without ejecting, e. g. for Angular Elements
1.19k stars 136 forks source link

This version of CLI is only compatible with Angular versions ^15.0.0, but Angular version 14.2.12 was found instead. #361

Open saket-r opened 1 year ago

saket-r commented 1 year ago

Getting this error when using ngx-build-plus: 14.0.0 with Angular 14 project

I found that its because the version range is not fixed to the bound of 14.x series hence npm downloads @angular-devkit/build-angular, @angular-devkit/core etc . of15.x.x versions locally inside node_modules which in turns causes the issue

image

The correct fix would be to add a range in the package.json of ngx-build-plus something like >= 14.0.0 < 15.0.0

The workaround in the package.json of our project we can add resolutions object which makes sure npm downloads the required versions for our project

"resolutions": {
    "@angular-devkit/build-angular": "14.2.10",
    "@angular-devkit/core": "14.2.10"
  },
frazzaglia commented 1 year ago

Related to #358

Lightllord commented 1 year ago

guys, remove this exceeded dependencies for a good being

mirzinho commented 1 year ago

faced the same issue, move the "ngx-build-plus": "14.0.0" to the bottom of devDependancies in package.json.

worked like a charm for me...

keeroll commented 1 year ago

Faced the same issue here.

Error message: This version of CLI is only compatible with Angular versions ^16.0.0, but Angular version 15.2.9 was found instead.

Updated project to the Angular 15, but npx-build-plus@15.0.0 installs dependencies for Angular 16. image_2023-05-10_19-56-46

I tried to set required dependencies manually before ngx-build-plus, but it still gets the latest.

UPD: Workaround with resolutions doesn't work for npm > 8.3. Use overrides instead.

"overrides": {
    "@angular-devkit/build-angular": "^15.2.0",
    "@angular-devkit/core": "^15.2.0"
  }