npm ERR! code EROFS — EROFS: read-only file system
npm tried to write to a read-only location (read-only container filesystem, mounted volume, or system path).
Seen on:
npm
Meaning
Containers with readOnlyRootFilesystem, serverless environments (/var/task is read-only) and global installs into system paths cause it.
Common causes
- Read-only container root filesystem
- Serverless runtime directories
- Writing cache to a read-only HOME
⚡ Quick fix
- Install at build time, not at runtime
- Point the npm cache to /tmp (npm_config_cache=/tmp/.npm)
- Mount a writable volume
Detailed fix by platform
npm
npm_config_cache=/tmp/.npm npm ci
How to diagnose
- Path — Which path is read-only?
- Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026