To install Nx on your machine, choose one of the following methods based on your operating system and package manager. You can also use npx
to run Nx without installing it globally.
npm add --global nx
Note: You can also use yarn
, pnpm
, or bun
brew install nx
choco install nx
sudo add-apt-repository ppa:nrwl/nxsudo apt updatesudo apt install nx
npm add --global nx
Note: You can also use yarn
, pnpm
, or bun
brew install nx
choco install nx
sudo add-apt-repository ppa:nrwl/nxsudo apt updatesudo apt install nx
Adding Nx to Your Repository
Section titled “Adding Nx to Your Repository”To add Nx to an existing repository, run:
nx init
Note: You can also manually install the nx
NPM package and create a nx.json to configure it. Learn more about adopting Nx in an existing project
Starter Repository
Section titled “Starter Repository”To create a starter repository, you can use the create-nx-workspace
command. This will create a new Nx workspace with a default configuration and example applications.
npx create-nx-workspace@latest
Update Nx
Section titled “Update Nx”When you update Nx, Nx will also automatically update your dependencies if you have an Nx plugin installed for that dependency. To update Nx, run:
nx migrate latest
This will create a migrations.json
file with any update scripts that need to be run. Run them with:
nx migrate --run-migrations
Tutorials
Section titled “Tutorials”Try one of these tutorials for a full walkthrough of what to do after you install Nx: