Reputation: 3012
I am a bit lost in the versioning system of nx (with angular). In my case, I want to upgrade from angular 12 to angular 13 with latest compatible tooling (jest, nx).
Agnular 14 is out now. So if I run the command below, it will update to angular 14.
nx migrate latest
How do I update to latest angular13 with latest compatible jest and other tooling?
What I do not understand is the connection between angular versions and nx versions. How are those two connected in terms of version numbers?
Best regards
Upvotes: 17
Views: 26562
Reputation: 380
I needed to update to Angular version 15 instead of the latest (v17 at the time of writing), based on https://nx.dev/nx-api/angular/documents/angular-nx-version-matrix I was able to upgrade to the Angular specific major version using the following migration commands:
npx nx migrate 12.2.0 // Angular 11.2.0
npx nx migrate 13.1.4 // Angular 12.8.18
npx nx migrate 14.1.9 // Angular 13.3.12
npx nx migrate 14.6.0 // Angular 14.2.12
npx nx migrate 15.9.7 // Angular 15.2.10
Upvotes: 4
Reputation: 547
Sometimes you need the very latest version of Angular and but a migration configuration is not yet available.
For instance, let's say Angular 17.1 is released on January 17, 2024, but as of today (January 22), the last available version according to the Angular and Nx Version Matrix is:
Angular Version Nx Version
~17.0.0 17.1.0 <= latest
Maybe you have already used these commands (as recommended by Nx):
# Update Nx to the latest version
nx update @nrwl/workspace
# Migrate Nx to the latest version
nx migrate latest
# If migration.json is created
nx migrate --run-migrations=migrations.json
# Update all packages to the latest version
npm install
And this process has updated your setup to version 17.0.0, but want to use Angular 17.1 (the latest possible version) immediately.
In this scenario, you might try:
npx npm-check-updates -u
npm i --legacy-peer-deps
The first command updates your package.json
to the latest package versions, while the second command takes care of installing the updates, respecting the necessary peer dependencies.
Using --legacy-peer-deps
can help you out, by bypassing the peer deps auto-installation. It is particularly useful when dealing with version mismatches or unmeet peer dependencies.
But there is no guarantee, that can work so in each time. Better use a versioning system (e.g. git) before you try to do so.
p.s. I could successfully upgrade to Angular 17.1 today.
Upvotes: 10
Reputation: 3012
Some months later ... I found this page https://nx.dev/angular-nx-version-matrix It seems the major numbers are connected between angular and nrwl-nx.
For a list of releases of angular-nx version numbers I found this page (maybe there is a better one?): https://github.com/nrwl/nx/releases If you want the latest angular 13, you have to look at previous pages till you find the last version 13.*.
I would also like to share some experience. To migrate from 12.x to 13.10.6 did not work (but to 14 worked out of the box). What we did is migrate to 13.0 first and then 13.10.6 in a second migration.
Upvotes: 11