Error: Cannot find module @rollup/rollup-linux-x64-gnu. npm has a bug related to optional dependencies
Rollup’s (and Vite’s) platform-specific optional dependency wasn’t installed — an npm optional-dependency bug with lockfiles from another platform.
Seen on:
npm
Meaning
Lockfiles created on macOS may omit Linux optional packages. Deleting the lockfile and node_modules and reinstalling fixes it.
Common causes
- Lockfile generated on another OS
- npm bug with optional dependencies (npm/cli#4828)
⚡ Quick fix
- Delete node_modules and package-lock.json, then npm install
- Or install the missing package explicitly for CI
Detailed fix by platform
npm
rm -rf node_modules package-lock.json && npm install
How to diagnose
- Lockfile — Generated on which OS?
- 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