🐞[BUG]: Angular 21 support
Affected Package
all
Is this a regression?
no
Description
When upgrading a project to Angular 21 (released a week ago) the build fails, caused be peer dependencies of ngxs, which pinpoint angular version to <21.0.0
🔬 Minimal Reproduction
Create a project with the following dependencies:
"dependencies": {
"@angular/animations": "21.0.0",
"@angular/cdk": "21.0.0",
"@angular/common": "21.0.0",
"@angular/compiler": "21.0.0",
"@angular/core": "21.0.0",
"@angular/forms": "21.0.0",
"@angular/platform-browser": "21.0.0",
"@angular/platform-browser-dynamic": "21.0.0",
"@angular/router": "21.0.0",
"@ngxs/logger-plugin": "20.1.0",
"@ngxs/storage-plugin": "20.1.0",
"@ngxs/store": "20.1.0",
"rxjs": "7.8.2",
"ts-node": "^10.9.2",
"tslib": "2.8.1"
},
🔥 Exception or Error
[INFO] npm error While resolving: @ngxs/[email protected]
[INFO] npm error Found: @angular/[email protected]
[INFO] npm error node_modules/@angular/core
[INFO] npm error @angular/core@"21.0.0" from the root project
[INFO] npm error peer @angular/core@"21.0.0" from @angular/[email protected]
[INFO] npm error node_modules/@angular/animations
[INFO] npm error @angular/animations@"21.0.0" from the root project
[INFO] npm error peerOptional @angular/animations@"21.0.0" from @angular/[email protected]
[INFO] npm error node_modules/@angular/platform-browser
[INFO] npm error @angular/platform-browser@"21.0.0" from the root project
[INFO] npm error 6 more (@angular/build, @angular/forms, @angular/material, ...)
[INFO] npm error 12 more (@angular/build, @angular/cdk, @angular/common, ...)
[INFO] npm error
[INFO] npm error Could not resolve dependency:
[INFO] npm error peer @angular/core@">=20.0.0 =20.0.0
Environment
Libs:
- @angular/core version: 21.0.0
- @ngxs/store version: 20.1.0
Browser:
- [X] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: v24.11.1
- Platform: Windows
Others:
🐞[BUG]: Angular 21 support
Affected Package
all
Is this a regression?
no
Description
When upgrading a project to Angular 21 (released a week ago) the build fails, caused be peer dependencies of ngxs, which pinpoint angular version to
<21.0.0🔬 Minimal Reproduction
Create a project with the following dependencies:
"dependencies": { "@angular/animations": "21.0.0", "@angular/cdk": "21.0.0", "@angular/common": "21.0.0", "@angular/compiler": "21.0.0", "@angular/core": "21.0.0", "@angular/forms": "21.0.0", "@angular/platform-browser": "21.0.0", "@angular/platform-browser-dynamic": "21.0.0", "@angular/router": "21.0.0", "@ngxs/logger-plugin": "20.1.0", "@ngxs/storage-plugin": "20.1.0", "@ngxs/store": "20.1.0", "rxjs": "7.8.2", "ts-node": "^10.9.2", "tslib": "2.8.1" },🔥 Exception or Error
[INFO] npm error While resolving: @ngxs/[email protected] [INFO] npm error Found: @angular/[email protected] [INFO] npm error node_modules/@angular/core [INFO] npm error @angular/core@"21.0.0" from the root project [INFO] npm error peer @angular/core@"21.0.0" from @angular/[email protected] [INFO] npm error node_modules/@angular/animations [INFO] npm error @angular/animations@"21.0.0" from the root project [INFO] npm error peerOptional @angular/animations@"21.0.0" from @angular/[email protected] [INFO] npm error node_modules/@angular/platform-browser [INFO] npm error @angular/platform-browser@"21.0.0" from the root project [INFO] npm error 6 more (@angular/build, @angular/forms, @angular/material, ...) [INFO] npm error 12 more (@angular/build, @angular/cdk, @angular/common, ...) [INFO] npm error [INFO] npm error Could not resolve dependency: [INFO] npm error peer @angular/core@">=20.0.0 =20.0.0Environment
Libs: - @angular/core version: 21.0.0 - @ngxs/store version: 20.1.0 Browser: - [X] Chrome (desktop) version XX - [ ] Chrome (Android) version XX - [ ] Chrome (iOS) version XX - [ ] Firefox version XX - [ ] Safari (desktop) version XX - [ ] Safari (iOS) version XX - [ ] IE version XX - [ ] Edge version XX For Tooling issues: - Node version: v24.11.1 - Platform: Windows Others:
Hey @beckerjohannes
Here is my answer:
The issue you're experiencing is due to the peer dependency constraints in the NGXS packages, specifically the @ngxs/devtools-plugin, which currently supports Angular versions >=20.0.0 <21.0.0. This constraint is causing a conflict when you attempt to upgrade to Angular 21, as the NGXS packages have not yet been updated to support this new version.
Current Situation
- NGXS Version: The
@ngxs/devtools-pluginand potentially other NGXS packages are set to work with Angular versions up to 20.x.x, as indicated by the peer dependency requirement@angular/core@">=20.0.0 <21.0.0". - Angular Version: You are trying to use Angular 21.0.0, which is outside the supported range for the current NGXS version.
Possible Solutions
-
Wait for an Update: The most straightforward solution is to wait for the NGXS team to release an update that supports Angular 21. This would involve updating the peer dependencies in the NGXS packages to include Angular 21.
-
Temporary Workaround: If you need to proceed with Angular 21 immediately, you could consider using a package manager option to ignore peer dependency warnings. However, this is not recommended for production environments as it might lead to unexpected behavior.
-
Contribute to NGXS: If you are familiar with the NGXS codebase, you could contribute by updating the peer dependencies and testing the compatibility with Angular 21. This would involve forking the repository, making the necessary changes, and submitting a pull request.
References
For now, monitoring the NGXS repository for updates or announcements regarding Angular 21 support would be advisable.
Trust Score: 🟢 100%
Sources:
Tag @gurubase to ask me a question.
I guess it is necessary to wait that this Nx PR is merged first ...
We are really looking forward to support for Angular 21.