Next.js 15: EACCES permission denied on .next cache directory
Error: EACCES: permission denied, open '/app/.next/cache/next-minifier-worker-1.js'
at Object.openSync (fs.js:585:3)
at Object.writeFileSync (fs.js:1290:35)
Immediate Remediation
bash
rm -rf .next && npm run build
Root Cause Analysis
The .next cache directory was created by a different user (e.g., root in Docker) and the current user lacks write permissions, causing the build process to fail when trying to write temporary files.
Verification & Guardrails
- Run in the project root directory.
- If using Docker, ensure the .next directory is not owned by root.
- Verify with 'ls -la .next' to check ownership.
Have a custom or uncategorized crash?
Run your trace through our in-memory client privacy sandbox for instant SRE remediation.