Installation
Create a new Nx workspace using the following command:
โฏ
npx create-nx-workspace
This will guide you through the setup, asking whether you want a monorepo or a standalone app and whether you want to start with a blank or a preconfigured setup.
~โฏ
npx create-nx-workspace@latest
1
2NX Let's create a new workspace [https://nx.dev/getting-started/intro]
3
4โ Where would you like to create your workspace? ยท myorg
5? Which stack do you want to use? โฆ
6None: Configures a TypeScript/JavaScript project with minimal structure.
7React: Configures a React application with your framework of choice.
8Vue: Configures a Vue application with your framework of choice.
9Angular: Configures a Angular application with modern tooling.
10Node: Configures a Node API application with your framework of choice.
11
Once you've created your workspace, you can
- run single tasks with
npx nx <target> <project>
- run multiple tasks with
npx nx run-many -t <target1> <target2>
Run npx nx run-many -t build
twice to see how Nx's powerful caching speeds up your build.
Learn more about running tasks.
Installing Nx Into an Existing Repository
If you want to add Nx to an existing repository run:
โฏ
npx nx@latest init
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
Installing Nx Globally
You can install Nx globally. Depending on your package manager, use one of the following commands:
โฏ
npm add --global nx@latest
The advantage of a global installation is that you don't have to prefix your commands with npx, yarn or pnpm. The global Nx installation hands off the process execution to the local Nx installation in your repository, which eliminates any issues with outdated globally installed packages.