nx: Cache invalidation not working with Nx Daemon on gitpod
Current Behavior
Nx local cache invalidation seems to be not working. If I change the content of a file listed on the inputs of the task and run the task again, I get an erroneous cache hit and the output of the task doesn’t change.
Note that I have copied this repro from a closed issue (#18289), and fixing the error in output path in that reproduction does not prevent the cache miss, as demonstrated by the linked reproduction repo here.
Also here is a screenshot of it failing to rebuild after a change.
"useDaemonProcess": false fixes this for me, so I will be keeping that setting permanently from now.
Expected Behavior
A cache miss would be expected.
GitHub Repo
https://github.com/dsschneidermann/nx-cache-invalidation-bug-repro
Steps to Reproduce
- Clone the repository
- Run npm install
- Run npm run test
- Change the contents of the string inside the console.log in packages/test/src/index.js
- Run npm run test
- Compare the outputted string with the expected
Nx Report
> NX Report complete - copy this into the issue template
Node : 18.17.1
OS : linux-x64
npm : 9.6.7
nx : 16.7.4
@nrwl/tao : 16.7.4
nx-cloud : 16.1.1
Failure Logs
No response
Package Manager Version
No response
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
No response
About this issue
- Original URL
- State: open
- Created 10 months ago
- Reactions: 8
- Comments: 17 (7 by maintainers)
Still an issue on nx 16.8.1 / node 18.17.1 / npm 10.0.0 - also on Linux. This is reproducible even with small monorepos. Thankfully, adding
"useDaemonProcess": falseto the task runner options or setting the environment variableNX_DAEMON=falsemitigate the issue for the time being.the fix for the runtime inputs using the env is here: 19422
Ran into the same issue today when setting up
nxfor the first timeMy changes to the Nx config would never work driving me insane as I poured over the Nx documentation trying to figure out what I was doing wrong. However, I every time I rage quit and came back to it, it would suddenly work again
After a lot of debugging, I now finally realize the issue is caused by the Daemon who fails to reload any changes to my files. The reason rage-quitting causes it to work again is because the Daemons restarts after 3hrs of inactivity so when you come back to the task things magically work
You can fix this by adding
"useDaemonProcess": falseto yournx.json