Next.js "Failed to load SWC binary for linux/x64"

I’m pretty new to Next Js and bolt.diy.

I’m trying to run a Next.js 14.2.3 project in bolt.diy.

The core issue is SWC failing to load

⚠ Attempted to load @next/swc-linux-x64-gnu, but an error occurred: Cannot load native addon because loading addons is disabled: /home/project/node_modules/@next/swc-linux-x64-gnu/next-swc.linux-x64-gnu.node
 ⚠ Attempted to load @next/swc-linux-x64-musl, but an error occurred: Cannot load native addon because loading addons is disabled: /home/project/node_modules/@next/swc-linux-x64-musl/next-swc.linux-x64-musl.node
 ⨯ Failed to load SWC binary for linux/x64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc

i asked Deepseek and some forums and both recommend disabling swc, but disabling it via Babel causes new errors.

Problem Sequence:

  1. Initial Error:
Failed to load SWC binary for linux/x64

Cause: (Deepseek) WebContainer blocks native binaries.

  1. Attempted Fixes:
  • Set swcMinify: false in next.config.js
  • Added .babelrc with next/babel preset
  • Removed experimental.swcCompiler flag after validation error
  1. New Error:
Syntax error: "next/font" requires SWC

Fix: Replaced next/font with CSS font imports.

  1. Next Error:

Cannot find module 'styled-jsx-plugin-postcss'

Fix: Installed the plugin and simplified Babel config.

  1. Current State:
  • Build fails with ENOENT: fallback-build-manifest.json
  • Babel still complains about missing modules despite clean installs.

Steps Taken:

  • Deleted .next, node_modules, and package-lock.json multiple times
  • Merged next.config.js into .mjs to avoid conflicts
  • Added NEXT_DISABLE_SWC=true to .env
  • Ensured no next/font usage remains

Environment:

Here’s my package.json

{
  "name": "refashion-dashboard",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@hookform/resolvers": "^3.4.2",
    "@next/swc-wasm-nodejs": "^14.2.3",
    "@radix-ui/react-alert-dialog": "^1.0.5",
    "@radix-ui/react-avatar": "^1.0.4",
    "@radix-ui/react-dialog": "^1.1.2",
    "@radix-ui/react-dropdown-menu": "^2.0.6",
    "@radix-ui/react-icons": "^1.3.0",
    "@radix-ui/react-label": "^2.0.2",
    "@radix-ui/react-navigation-menu": "^1.2.0",
    "@radix-ui/react-popover": "^1.0.7",
    "@radix-ui/react-radio-group": "^1.2.0",
    "@radix-ui/react-select": "^2.0.0",
    "@radix-ui/react-separator": "^1.0.3",
    "@radix-ui/react-slot": "^1.0.2",
    "@radix-ui/react-switch": "^1.0.3",
    "@radix-ui/react-tabs": "^1.1.0",
    "@tanstack/react-table": "^8.16.0",
    "axios": "^1.6.8",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.1",
    "cmdk": "^1.0.0",
    "date-fns": "^3.6.0",
    "jsbarcode": "^3.11.6",
    "jspdf": "^2.5.1",
    "lucide-react": "^0.376.0",
    "next": "14.2.3",
    "next-auth": "^4.24.7",
    "next-themes": "^0.3.0",
    "react": "^18",
    "react-day-picker": "^8.10.1",
    "react-dom": "^18",
    "react-hook-form": "^7.51.5",
    "sonner": "^1.4.41",
    "styled-jsx-plugin-postcss": "^4.0.1",
    "tailwind-merge": "^2.3.0",
    "tailwindcss-animate": "^1.0.7",
    "uuid": "^10.0.0",
    "vaul": "^0.9.1",
    "zod": "^3.23.8"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "@types/uuid": "^10.0.0",
    "eslint": "^8",
    "eslint-config-next": "14.2.3",
    "postcss": "^8",
    "tailwindcss": "^3.4.1",
    "typescript": "^5"
  }
}

Question:
First of all, why is this problem happening, is this anything to do with SWC? (Yes, i’ve tried running the project locally and in a server as well, both work fine)

How can I fully disable SWC and satisfy Babel/PostCSS dependencies in a restricted environment? Are there critical config tweaks I’m missing?

I there is anything else i can provide to help solve this, I’m ready to provide

Hi,
I dont know why this happens, but a solution could be to use a starter template, if you didnt do in the beginning. With a good base, its maybe not happening.

1 Like

Yes, I’ll be sure to from the next project.
I literally just discovered bolt.diy 7 hrs ago haha and have been tweaking around, and wanted to see if it could help me with some menial tasks left in this project (like making the code responsive)

Ok, maybe try then switching to Google Gemini 2.0 and see if it can fix it.

1 Like

nope, tried with that, GPT o1 and Deepseek’s playground as well, but i’ve compoiled the results above

One thing i am doing is that i have separate live database and image servers i’m calling to from this project. Would that cause any issues?

dont think this has anything todo with the error.

But as I understood you got your project running and want to do some changes, so the errors just happen when you do a prompt and it fu***s it up then? When just importing, you can run it and see the preview?

no no,
Here are the only things i did:

  1. added Gemini Key
  2. Selected Gemini Flash
  3. import whole next js project folder
  4. bolt automatically runs npm install and npm run dev
  5. i get the error.

ok, does this project then work outside of bolt? And if so, with what node version?
bolt/webcontainer has NodeJS Version 18, so the application needs to be compatible with that version.

Sorry, didn’t get notified of your reply.

Asi mentioned in the initial post, yes - this post does work outside of BOLT

I’m using node 20.12.2