The @nx/powerpack-shared-fs-cache
plugin enables you to use a shared file system directory instead of Nx Cloud to host your remote cache. You are responsible for the sharing mechanism for the directory, but the plugin ensures that Nx correctly associates task metadata with the file artifacts.
This plugin will enable the remote cache for your Nx workspace, but does not provide any of the other features of Nx Cloud. If you want to leverage distributed task execution, re-running flaky tasks or automatically splitting tasks, you'll need to connect to Nx Cloud and use Nx Replay instead.
Using a shared file system folder for the remote cache opens you up to the possibility of cache poisoning. To avoid this, use Nx Replay.
In order to use @nx/powerpack-shared-fs-cache
, you need to have an active Powerpack license. If you don't have a license or it has expired, your cache will no longer be shared and each machine will use its local cache.
Set Up @nx/powerpack-shared-fs-cache
1. Install the Package
- Activate Powerpack if you haven't already
- Install the package
❯
nx add @nx/powerpack-shared-fs-cache
2. Configure the Cache Directory
The @nx/powerpack-shared-fs-cache
plugin treats your local cache directory as if it is also a remote cache directory. The local cache directory can be set using cacheDirectory
in the nx.json
file or the NX_CACHE_DIRECTORY
environment variable. The default local cache directory is .nx/cache
3. Share the Cache Directory
The @nx/powerpack-shared-fs-cache
plugin does not actually share the cache directory across your organization. You are responsible for enabling the actual sharing mechanism. If you want Nx to handle the sharing, use Nx Replay instead. Your shared file system directory might be a directory that is saved and restored by a CI provider or it could be a shared network drive.