How to remove Nx cloud from your app
Nx ships your code to their cloud to "increase performance" - with little warning...
Errors when using Nx cloud
If you are getting errors such as:
Error when connecting to Nx Cloud. Code: 401.
Nx Cloud Problems
connect ENOENT /var/folders/../../T/../d.sock
Watch error: Daemon closed the connection
You most likely will want to switch to local runners.
What is Nx cloud doing for me?
The Nx Cloud Task Runner has the following features that are meant to help larger, distributed teams when building with Nx:
1. Distributed Caching: When you run a task (e.g., a build or test), the task runner checks if that task has been previously run with the same inputs. If it has and there's a cached result available on Nx Cloud, it will use that cached result instead of re-running the task. This can save a lot of time.
2. Distributed Execution: This allows you to run tasks not just on your machine but also on other machines, distributing the workload. This is especially useful when there are many tasks to run, like a large set of unit tests.
For small projects or people working by themselves its entirely unecessary to use Nx cloud.
How do I remove its usage from my repo?
Nx Cloud runner is configured in the nx.json file located at the root of your repo.
"tasksRunnerOptions": {
"default": {
"runner": "nx-cloud",
"options": {
"cacheableOperations": ["build", "lint", "test", "e2e"],
"accessToken": "...token"
}
}
}
Simply swap this to a local runner:
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "lint", "test", "e2e"],
"parallel": 5
}
}
}
Optionally you can uninstall nx-cloud runner by running
npm remove nx-cloud
And you’re done! Run your nx build, serve, lint tasks as normal. In my experience with a simple monorepo for GordonApp it didn’t harm performance.