How to generate NX monorepo with different Angular version

304 Views Asked by At

I started exploring the possibility of switching to monrepo using NX. I ran into a problem when I generate a new project according to the instructions from the site, the latest version of Angular is used (>16.0.0).

Is there a possibility to choose the version required for use? Or it remains to use only the outdated version of "create-nx-workspace", although judging by the information (in NX site), Angular 14.2.0 is supported by the latest version, as I understand.

-

Please note that on one of the sites I saw a flag that allows you to select a version, I tried to find a mention on the NX site, but I didn't find anything. In particular, the use of migration to a new version also updates the Angular version

On similar questions, the choice of the old version of the "create-nx-workspace" package is suggested, but perhaps I understand something wrong. On the site, if I understand correctly, support for Angular 14 and newer versions is indicated

1

There are 1 best solutions below

0
On

You can create a new angular 14 project and then migrate it to nx workspace.

npm install -g @angular/cli@14

ng new my-14

cd my-14

npx nx@latest init --integrated

UPDATE:

Create an empty nx workspace and install @nrwl/angular

npx create-nx-workspace@latest ang-15

cd ang-15

npm i -save-dev @angular-devkit/build-angular@15

npm install --save-dev @nx/angular