Reading the repo
Opening the box…
Reading the repo
Opening the box…
How to install on Windows
Written by AI from the README.
Saved setup from 1 days ago
Will it work on Windows?
Also: Docs ↗ · In the browser ↗
CONTRIBUTING.mdWe would love for you to contribute to Nx! Read this document to see how to do it.
We are trying to keep GitHub issues for bug reports and feature requests. You can join our Discord for general questions and seeking help from others.
If you find a bug in the source code or a mistake in the documentation, you can help us by submitting an issue to our GitHub Repository. Even better, you can submit a Pull Request with a fix.
Source code and documentation are included in the top-level folders listed below.
packages - Source code for Nx packages such as Angular, React, Web, NestJS, Next and others including generators and
executors (or builders).e2e - E2E tests for the Nx packagesgraph - Source code for the Nx Graph application which shows the project graph, task graph, project details, and more in the browser.docs - Markdown and configuration files for documentation including tutorials, guides for each supported platform,
and API docs.nx-dev - Source code for the Nx documentation site which displays the markdown in docs and more.tools - Workspace-specific tooling and pluginsscripts - Miscellaneous scripts for project tasks such as building documentation, testing, and code formatting.tmp - Folder used by e2e tests. If you are a WebStorm user, make sure to mark this folder as excluded.This repo contains a mix of different technologies, including:
For local development with mise, install the tools declared in mise.toml:
mise install
Activate mise in your shell, or prefix commands with mise exec --. The configuration keeps Java 24 as the default runtime and installs Temurin JDK 17 for Gradle compilation. Mise sets JAVA17_HOME, which gradle.properties uses to discover that compiler toolchain. Gradle's automatic JDK downloads are disabled, so installing Java 24 alone is insufficient.
To verify toolchain discovery and start the documentation site with its build dependencies:
mise exec -- pnpm nx run ':gradle-batch-runner:gradle:javaToolchains' --skipNxCache
mise exec -- pnpm nx serve astro-docs
The toolchain report should list JDK 17 as detected through JAVA17_HOME and Java 24 as the current JVM. With mise activated, you can run the same pnpm nx commands directly.
If you are using VSCode, and provided you have Docker installed on your machine, then you can leverage Dev Containers through this VSCode extension, to easily setup your development environment, with everything needed to contribute to Nx, already installed (namely NodeJS, Yarn, Rust, Cargo, plus some useful extensions like Nx Console).
To do so, simply:
The repo comes with a preconfigured devcontainer.json file (located in .devcontainer/ folder at root), that VSCode will automatically use to install the aforementioned tools, inside a Docker image. It will even run pnpm install for you, so you can start contributing to Nx right after.
If you open the repo in Github Codespace, it will also leverage this config file, to setup the codespace, with the same required tools.
💡 Troubleshooting
If you are having issues when running Nx commands like
build,test... related to the version ofGLIBC, it probably means the version that is installed on the devcontainer, is outdated compare to the minimum version required by Nx tools.You can check currently installed version by running the following command, in a terminal within the container:
ldd --versionThen, try updating the base image used in devcontainer.json and rebuild it, to see if it solved the issue.
Current base image is
"mcr.microsoft.com/devcontainers/typescript-node:20-bookworm"which is based onDebian-12 (bookworm), which comes withGLIBC v2.36pre-installed (Nx tools currenlty requiresGLIBC v2.33or higher).
💡 Nx uses
Rustto build native bindings for Node. Please make sure that you have Rust installed via rustup.rs If you haveVSCode+Docker, this can be automated for you, see section above
After cloning the project to your machine, to install the dependencies, run:
pnpm install
// or prefer...
pnpm install --frozen-lockfile // if you haven't changed any dependency
To build all the packages, run:
pnpm build
To test if your changes will actually work once the changes are published, it can be useful to publish to a local registry.
Check out this video for a live walkthrough or follow the instructions below:
pnpm local-registry in Terminal 1 (keep it running)npm adduser --registry http://localhost:4873 in Terminal 2 (real credentials are not required, you just need to
be logged in. You can use test/test/test@test.io.)pnpm nx-release 20.0.0 --local in Terminal 2 - you can choose any nonexistent version number here, but it's recommended to use the next majorcd ./tmp in Terminal 2npx create-nx-workspace@20.0.0 in Terminal 2If you have problems publishing, make sure you use Node 18 and NPM 8.
NOTE: To use this newly published local version, you need to make a new workspace, run nx migrate or change all of your target packages to this new version, eg: "nx": "^20.0.0", and re-run pnpm i in your testing project.
Yarn Berry operates slightly differently than Yarn Classic. In order to publish packages for Berry follow next steps:
Run yarn set version berry to switch to latest Yarn version.
Create .yarnrc.yml in root with following contents:
nodeLinker: node-modules
npmRegistryServer: 'http://localhost:4873'
unsafeHttpWhitelist:
- localhost
Run pnpm local-registry in Terminal 1 (keep it running)
If you are creating nx workspace outside of your nx repo, make sure to add npm registry info to your root yarnrc ( usually in ~/.yarnrc.yml). The file should look something like this:
npmRegistries:
'https://registry.yarnpkg.com':
npmAuthToken: npm_******************
yarnPath: .yarn/releases/yarn-3.2.2.cjs
npmRegistryServer: 'http://localhost:4873'
unsafeHttpWhitelist:
- localhost
Run pnpm nx-release minor --local in Terminal 2 to publish next minor version. The output will report the version of published packages.
Go to your target folder (e.g. cd ./tmp) in Terminal 2
Run yarn dlx create-nx-workspace@123.4.5 in Terminal 2 (replace 123.4.5 with the version that got published).
To make sure your changes do not break any unit tests, run the following:
nx affected --target=test
For example, if you need to only run the tests for the jest package, run:
nx test jest
Use Node 18 and NPM 8. E2E tests won't work on Node 15 and NPM 7.
To make sure your changes do not break any E2E tests, run:
nx e2e e2e-vite # or any other project here
Running E2E tests can take some time, so it is often useful to run a single test. To run a single suite of tests, run:
nx e2e e2e-vite -t versions # I often add qqqq to my test name so I can use -t qqqq
Sometimes tests pass locally but they fail on the CI. To reproduce the CI environment and be able to debug the issue, run:
NX_VERBOSE_LOGGING=true CI=true SELECTED_PM=pnpm pnpm nx e2e e2e-vite --t="should do something is this test"
The above command sets verbose logging (this exposes stack traces and underlying errors), sets the defaults to be CI-like and sets Pnpm as the selected package manager.
E2E tests and unit tests can share a CI machine. Choose ports according to what the test needs:
reservePort() from @nx/e2e-utils.
Use reservePorts(count) when the fixture needs consecutive ports.
In CI, don't choose a later server's port by opening and closing a port-zero probe.
Another process can bind that number before the server starts.reservePort() from @nx/devkit/internal-testing-utils
when NX_E2E_PORT_POOL is set.
Follow the conditional allocation in the
Vite readiness tests.
The unconfigured local path preserves legacy port-zero probing without shared CI claims.Keep servers and clients on the same reserved address:
configureTargetOptions() before generation when generated URLs depend on target defaults.
If the workspace will be reused beyond the options' scope, save the returned restore function
and call it when that scope ends.
Use finally for a block, afterEach for per-test cleanup, or afterAll for suite-wide setup.
The Next Playwright tests share one reservation
across both E2E runs.dev for development and preview for CI browser tests.
Set strictPort: true on Vite targets and React Router dev targets that use reserved ports.
Automatic fallback can take another test's reserved port before its server starts.server.strictPort: true in its config because its CLI has no strict-port option.
Use createRsbuildPortConfig() to create an alternate config that loads
and merges the generated config through the Rsbuild APIs.
Pass its returned filename as the server target's config option through configureTargetOptions().
Its optional port argument overrides the generated port.scheduling-constraints and cannot-run-with
selectors in .nx/ci-config.yaml,
following the module-federation rule.
These constraints exclude matching tasks from running together on one agent.
Other tasks can still share the agent, and conflicting cases within one task must run sequentially.CI sets NX_E2E_PORT_POOL=10000-32767, above common framework defaults.
The allocator checks that the pool avoids the current Linux or macOS automatic port ranges.
Requests with a configured pool throw on other platforms.
Processes sharing the same local network namespace must share the nx-e2e-port-locks directory
under os.tmpdir().
Reservations coordinate participating helpers but don't hold sockets or exclude other tools
that bind an explicit port.
Stop servers owned by the test during teardown.
With the pool set, don't add cleanup that deletes claims or the nx-e2e-port-locks directory
when a test, suite, or parent process finishes.
A child server or pending startup task can still need the port.
Those claims stay until the shared directory is discarded.
The configured pool contains 22,768 ports.
When no port remains available, reservePort() throws No available ports.
reservePorts(count) throws No available run of N consecutive ports when no suitable block remains,
even if individual ports are still available.
To build Nx on Windows, you need to use WSL.
pnpm install in WSL. Yarn will compile several dependencies. If you don't run install in WSL, they will be
compiled for Windows.nx affected --target=test and other commands in WSL.We would love for you to contribute to our documentation as well! Please feel welcome to submit fixes or enhancements to
our existing documentation pages, astro-docs and the nx-dev application in this repo.
Our documentation pages can be found within this repo under the astro-docs/src/content/docs directory.
Documentation is written in .mdoc (Markdoc) or .mdx (MDX) format and supports custom Markdoc tags for rich content
such as videos, graphs, interactive components, and more. See the astro-docs/README.md for a full list of available
custom tags and their usage.
The sidebar structure is defined in astro-docs/sidebar.mts and should be updated when adding new sections or pages
to ensure proper navigation.
Our public nx.dev/docs documentation site is built with Astro and Starlight,
and can be found in the astro-docs directory of this repo. See docs README for more details
The nx-dev directory contains a Next.js application used for blog posts and landing pages.
Jump to Running the Documentation Site Locally to see how to preview your changes while serving.
API documentation for CLI commands, executors, and generators is automatically generated during the build process from
the corresponding schema.json files in each package.
The documentation is generated using content loaders in the astro-docs application and requires a rebuild to reflect
changes. After adjusting a schema.json file:
nx serve astro-docs to see the changesnx preview astro-docs to view the built site locallyNote that adjusting the schema.json files will also affect the CLI manuals and Nx Console behavior, in addition to
the generated documentation.
To run the documentation site locally, run the command:
nx serve astro-docs
You can then access the application locally at localhost:4321. Changes to markdoc files should reflect automatically in the browser on save.
To view plugin registry statistics (GitHub stars, npm downloads, etc.) during local development:
NX_DOCS_PLUGIN_STATS=true nx serve astro-docs
Note: Plugin stats are disabled by default in development to improve performance.
When submitting a PR, this repo will automatically generate a preview of the documentation site based on the contents of your pull request.
Once the preview site is launched, a comment will automatically be added to your PR with the link to your PR's preview.
Before you submit an issue, please search the issue tracker. An issue for your problem may already exist and has been resolved, or the discussion might inform you of workarounds readily available.
We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce and confirm it. Having a reproducible scenario gives us wealth of important information without going back and forth with you requiring additional information, such as:
nx reportyarn.lock or package-lock.json or pnpm-lock.yamlA minimal reproduction allows us to quickly confirm a bug (or point out a coding problem) as well as confirm that we are fixing the right problem.
We will be insisting on a minimal reproduction in order to save maintainers' time and ultimately be able to fix more bugs. Interestingly, from our experience, users often find coding problems themselves while preparing a minimal reproduction repository. We understand that sometimes it might be hard to extract essentials bits of code from a larger codebase, but we really need to isolate the problem before we can fix it.
You can file new issues by filling out our issue form.
Please follow the following guidelines:
nx affected --target=test)
nx run proj:test (i.e. nx run angular:test to target packages/angular)packages/angular/src/utils/ast-command-line-utils.spec.ts)
with npx jest angular/src/utils/ast-utils or npx jest packages/angular/src/utils/ast-utilspackages/nx, packages/workspace, packages/rspack, packages/rsbuild, packages/angular, packages/react, packages/plugin, packages/js, packages/storybook, packages/remix, packages/next, packages/expo, packages/react-native, packages/eslint, packages/oxlint, packages/eslint-plugin, packages/devkit, packages/web, packages/vite, packages/webpack, packages/vitest, packages/rollup, packages/esbuild, packages/cypress, packages/playwright, packages/gradle, packages/dotnet, packages/maven, packages/vue, packages/nuxt, packages/module-federation, packages/create-nx-workspace, packages/create-nx-plugin, packages/node, packages/express, packages/docker, packages/nest and packages/detox run on vitest instead: target a file with
nx run nx:test -- src/utils/formatters/oxfmt.spec.ts (paths relative to the package)npx jest --help or visit jestjs.ionode --inspect-brk ./node_modules/jest/bin/jest.js build/packages/angular/src/utils/ast-utils.spec.jsnx affected --target=e2e)
nx e2e e2e-cypressnx formatpnpm documentation. For documentation, check for spelling and grammatical errors.pnpm commit to automate compliance)
pnpm check-commit will check to make sure your commit messages are formatted correctlyThe commit message should follow the following format:
type(scope): subject
BLANK LINE
body
The type must be one of the following:
Then run powershell -ExecutionPolicy Bypass -File .\setup.ps1. It stops at the first error and is safe to run again. Servers and tests aren't started; it lists them at the end. Read it first.
Needs Git: winget install Git.Git
git clone https://github.com/nrwl/nx.git cd nx
Node.js 24, Rust 1.97.0, JDK 17, .NET SDK
winget install jdx.mise mise install
corepack enable pnpm install cargo build .\mvnw.cmd install -DskipTests dotnet restore nx.sln dotnet build nx.sln
.\mvnw.cmd exec:java
pnpm test cargo test dotnet test nx.sln
No reports for Windows yet.
GitManual AI Agent reads the 17 key files and writes a step-by-step guide for Windows. Once written, it's saved for everyone.