Next.js 15: Failed to load SWC binary for platform
Failed to load SWC binary for linux-x64-gnu (caused by: Error: Cannot find module '@next/swc-linux-x64-gnu')
Please try reinstalling dependencies or ensure your platform is supported.
Immediate Remediation
bash
Run `npm install` or `yarn install` to reinstall dependencies. If the issue persists, delete `node_modules` and `package-lock.json` (or `yarn.lock`) and reinstall. For custom platforms, ensure you have the correct optional dependencies installed.
Root Cause Analysis
Next.js uses SWC (a Rust-based compiler) for fast builds. The SWC binary is platform-specific and installed as an optional dependency. If the binary is missing or mismatched (e.g., due to a partial install or platform change), Next.js cannot load it, causing a build/runtime failure.
Verification & Guardrails
- Check that your Node.js version is compatible with the installed Next.js version; some SWC binaries require specific Node versions.
- If you are using a custom platform (e.g., Alpine Linux), you may need to install the musl variant of the SWC binary.
- Verify that your lockfile is up-to-date and includes the correct optional dependencies for your OS.
Have a custom or uncategorized crash?
Run your trace through our in-memory client privacy sandbox for instant SRE remediation.