NX Cache and Bitbucket Pipelines

We recently added Nx to our Angular application. Nx is a set of extensible dev tools for monorepos. We were trying to deploy our application to Firebase Hosting using Bitbucket Pipelines. The build was failing because the NX cache was not being cleared. We were able to fix this by adding the following environment variable to our Bitbucket Pipelines configuration:


The problem is the cache is machine specific and we had different steps for building versus deploying and the cache was not being cleared between steps. We could have added a step to clear the cache, but we decided to skip the cache altogether.

Tags: nxbitbucket