GitHub Actions container job "HOME is not set"
Some container images run as a user with no HOME defined, or HOME points at a path that is not writable in the runner mount. Tools that write config or caches under HOME then fail.
What this error means
A step inside a container job fails because a tool cannot resolve or write to the home directory.
github-actions
npm error code ENOENT
npm error path /nonexistent/.npmrc
npm error errno -2
##[error]Process completed with exit code 254.Common causes
Image user has no HOME
A minimal image runs as a UID with no /etc/passwd entry, so HOME is empty and tools fall back to "/" or "/nonexistent".
HOME points outside the writable mount
The default HOME path is read-only inside the container, blocking config and cache writes.
How to fix it
Set HOME to a writable path
- Export HOME (and any tool-specific cache dirs) to a path under the workspace.
- Create the directory before the tool runs.
- Re-run.
.github/workflows/ci.yml
- name: Configure HOME
run: echo "HOME=${GITHUB_WORKSPACE}" >> "${GITHUB_ENV}"
- run: |
npm config set cache "${GITHUB_WORKSPACE}/.npm"
npm ciHow to prevent it
- Set HOME explicitly for container jobs built on minimal images.
- Point tool caches at the workspace so they are writable and cacheable.
Related guides
GitHub Actions "EACCES: permission denied" in a container jobFix GitHub Actions "EACCES: permission denied" inside a container job - the container user cannot write to th…
GitHub Actions container job "workdir not found"Fix the GitHub Actions error where a container job sets an --workdir option pointing at a path that does not…
GitHub Actions "RUNNER_TEMP is not writable"Fix the GitHub Actions error where steps or actions fail because the RUNNER_TEMP directory is read-only or ow…