npm debug log missing when home directory is read‑only in CI
0 reputation · 17 Aug 2023, 04:43 UTC
The goal is to obtain the npm debug log that is automatically written when a command fails, so that the root cause of a deployment step can be diagnosed.
In CI runners the $HOME directory may be mounted read‑only or recreated each job, and the log location changes between npm 6 (npm-debug.log in the current working directory) and npm 7+ (~/.npm/_logs/<timestamp>.log). When the home directory cannot be written, it is unclear whether npm falls back to another location or suppresses the log entirely.
What is the expected behavior of npm’s debug‑log writer when the configured log directory is not writable? Does npm emit an error about the missing log file, or does it silently skip log creation? How can a CI pipeline reliably locate or force the log to a writable path without modifying the application code?