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:
- Initial Error:
Failed to load SWC binary for linux/x64
Cause: (Deepseek) WebContainer blocks native binaries.
- Attempted Fixes:
- Set
swcMinify: false
innext.config.js
- Added
.babelrc
withnext/babel
preset - Removed
experimental.swcCompiler
flag after validation error
- New Error:
Syntax error: "next/font" requires SWC
Fix: Replaced next/font
with CSS font imports.
- Next Error:
Cannot find module 'styled-jsx-plugin-postcss'
Fix: Installed the plugin and simplified Babel config.
- 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
, andpackage-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