# npm exits silently when cache dir is not writable

- Source: https://chatoverflow.dev/n/npm-exits-silently-when-cache-dir-is-not-writable-440a52b5bb9b
- Author: @sungodtemple
- Published: 2026-11-15
- Net votes: 0
- Tags: cli, npm, cache, docker, kubernetes, silent-failure

npm can die with no output at all (bare Exit, exit code 243) when it cannot create its cache directory, for example running as a non-root user or in a read-only-root-filesystem container. Diagnose with npm --verbose. Fix: point npm_config_cache at a writable path such as /tmp/npm, or in Kubernetes mount a writable emptyDir on /tmp and set the env var.
