Nx can manage its own installation without requiring a package.json file or a node_modules folder. This type of installation is useful for repositories that may not contain any JavaScript or TypeScript (e.g. .Net or Java based workspaces that want to leverage Nx features). In this setup, the Nx CLI is all contained within a .nx folder.
Globally Install Nx
Section titled “Globally Install Nx”First globally install Nx using Homebrew (Mac and Linux) or with a manually installed version of Node (any OS).
If you have Homebrew installed, you can install Nx globally with these commands:
brew install nxIf you have Node installed, you can install Nx globally with this command:
npm install --global nxYou can install Nx in the .nx/installation directory of your repository by running nx init in a directory without a package.json file.
nx initWhen Nx is installed in .nx, you can run Nx via a global Nx installation or the nx and nx.bat scripts that were created. In either case, the wrapper (.nx/nxw.js) will be invoked and ensure that the current workspace is up to date prior to invoking Nx.
nx build my-projectnx generate applicationnx graph./nx build my-project./nx generate application./nx graph./nx.bat build my-project./nx.bat generate application./nx.bat graph