Global Installation
Section titled “Global Installation”Install Nx globally to run commands from anywhere. Choose a method based on your operating system and package manager.
npm add --global nxNote: You can also use yarn global add nx, pnpm add --global nx, or bun add --global nx
brew install nxchoco install nxsudo add-apt-repository ppa:nrwl/nxsudo apt updatesudo apt install nxVerify Installation
Section titled “Verify Installation”nx --versionYou should see a version number like 22.5.0.
Update Global Installation
Section titled “Update Global Installation”npm update --global nxNote: You can also use yarn global upgrade nx, pnpm update --global nx, or bun update --global nx
brew upgrade nxchoco upgrade nxsudo apt updatesudo apt upgrade nxInstall in a Repository
Section titled “Install in a Repository”To add Nx to an existing repository, run:
npx nx@latest initThis 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.
Update Nx in Your Repository
Section titled “Update Nx 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:
nx migrate latestThis creates a migrations.json file with any update scripts that need to be run. Run them with:
nx migrate --run-migrations