Skip to content

Install Nx globally to run commands from anywhere. Choose a method based on your operating system and package manager.

Terminal window
npm add --global nx

Note: You can also use yarn global add nx, pnpm add --global nx, or bun add --global nx

Terminal window
nx --version

You should see a version number like 22.5.0.

Terminal window
npm update --global nx

Note: You can also use yarn global upgrade nx, pnpm update --global nx, or bun update --global nx

To add Nx to an existing repository, run:

Terminal window
npx nx@latest init

This installs the nx package as a dev dependency and creates an nx.json configuration file. If you have Nx installed globally, it will defer to the local version in your repository.

When you update Nx in your repository, it will also automatically update your dependencies if you have an Nx plugin installed for that dependency. To update Nx, run:

Terminal window
nx migrate latest

This creates a migrations.json file with any update scripts that need to be run. Run them with:

Terminal window
nx migrate --run-migrations