This version of CLI is only compatible with Angular versions ^17.0.0, how to fix

634 views Asked by At

I have added "@angular-architects/module-federation": "^17.0.1", after that i am getting this error as version compatible. working on micro-services. how to fix this?

package.json:

{
  "name": "qonchdemo",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "start:host-app": "ng serve host-app  -o --port 5000",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test",
    "run:all": "node node_modules/@angular-architects/module-federation/src/server/mf-dev-server.js"
  },
  "private": true,
  "dependencies": {
    "@angular-architects/module-federation": "^17.0.1",
    "@angular/animations": "^16.1.0",
    "@angular/common": "^16.1.0",
    "@angular/compiler": "^16.1.0",
    "@angular/core": "^16.1.0",
    "@angular/forms": "^16.1.0",
    "@angular/platform-browser": "^16.1.0",
    "@angular/platform-browser-dynamic": "^16.1.0",
    "@angular/router": "^16.1.0",
    "bootstrap": "^5.3.2",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.13.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^16.1.8",
    "@angular/cli": "~16.1.6",
    "@angular/compiler-cli": "^16.1.0",
    "@types/jasmine": "~4.3.0",
    "jasmine-core": "~4.6.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.1.0",
    "ngx-build-plus": "^17.0.0",
    "typescript": "~5.1.3"
  }
}

I tried to downgrade angular-federation but it didn't work out, my local cli version is 16.2.12 node is 16. I have other projects in my system if i'll upgrade to node 18 it will be a problem.

1

There are 1 answers

1
sommmen On

Well, angular cli v17 depends on node 18.13.0 https://angular.io/guide/versions so your module-fedepartion dependency needs to use maximum v16, because module-federation v17 uses angular v17 which has the node minimum of 18.13.0.

So i'm guessing if you just install v16 instead of 17 you'd be fine.