Failed to load SWC feedback #30468
Replies: 170 comments 235 replies
-
getting this error |
Beta Was this translation helpful? Give feedback.
-
I'm building a multiarch docker build via Github Actions. It fails for
Next.js version: 12.0.1 |
Beta Was this translation helpful? Give feedback.
-
I have the same problem |
Beta Was this translation helpful? Give feedback.
-
I don't have access to the CI command line, but this is the output I have.
Full output:
|
Beta Was this translation helpful? Give feedback.
-
I got the following error message:
After a lot of digging I realized we had set Perhaps we could add some info to https://nextjs.org/docs/messages/failed-loading-swc that one should make sure to allow optional dependencies. |
Beta Was this translation helpful? Give feedback.
-
Getting this error inside a docker container:
Some additional info:
|
Beta Was this translation helpful? Give feedback.
-
Node Version: node:14-alpine in Docker. FROM node:14-alpine
RUN ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2
RUN mkdir -p /app
WORKDIR /app
COPY package*.json /app
RUN yarn install
COPY . /app
EXPOSE 3000
CMD ["yarn", "dev"] Error:
also tried with Working when switched to this Dockerfile config to use Ubuntu 18 with FROM ubuntu:18.04
# Install Node.js
RUN apt-get update
RUN apt-get -y install curl
RUN apt-get -y install sudo
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
RUN apt-get install -y build-essential
RUN apt-get install -y nodejs
# Install Yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
RUN sudo apt-get update
RUN sudo apt-get install yarn
RUN mkdir -p /app
WORKDIR /app
COPY package*.json /app
RUN yarn install
COPY . /app
EXPOSE 3000
CMD ["yarn", "dev"] |
Beta Was this translation helpful? Give feedback.
-
Running into this issue on Vercel, weirdly enough. Locally Notably I'm using npm instead of yarn, so maybe something is wrong with its resolution? |
Beta Was this translation helpful? Give feedback.
-
OS: CentOS Linux release 7.8.2003 (Core) $ npm run build:qa
> ****@0.1.0 build:qa /home/gitlab-runner/builds/******
> cross-env NODE_ENV=production APP_ENV=qa next build
info - Checking validity of types...
info - Creating an optimized production build...
Can not load bindings, file: /home/gitlab-runner/builds/****/node_modules/@next/swc-linux-x64-gnu/next-swc.linux-x64-gnu.node existed but error occurred while require it: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /home/gitlab-runner/builds/****/node_modules/@next/swc-linux-x64-gnu/next-swc.linux-x64-gnu.node)
file: /home/gitlab-runner/builds/****/node_modules/@next/swc-linux-x64-musl/next-swc.linux-x64-musl.node existed but error occurred while require it: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory
error - failed to load SWC binary, see more info here: https://nextjs.org/docs/messages/failed-loading-swc
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ***@0.1.0 build:qa: `cross-env NODE_ENV=production APP_ENV=qa next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ***@0.1.0 build:qa script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/gitlab-runner/.npm/_logs/******-debug.log |
Beta Was this translation helpful? Give feedback.
-
Next.js examples are no longer working on StackBlitz because it is failing to load SWC. For example, try running the with-route-as-modal example: It runs fine when I disable SWC by adding a Error log~/projects/rlmizznwz.github
❯ npm install && npx next dev
warn preInstall No description field
warn preInstall No repository field
warn preInstall No license field
┌ [1/3] 🔍 Resolving dependencies
└ Completed in 0.615s
┌ [2/3] 🚚 Fetching dependencies
│ info pruneDeps Excluding 7 dependencies. For more information use `--verbose`.
└ Completed in 6.88s
┌ [3/3] 🔗 Linking dependencies
└ Completed in 0.695s
success Saved lockfile "package-lock.json"
success Updated "package.json"
success Install finished in 8.353s
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
Can not load bindings, file: /home/projects/rlmizznwz.github/node_modules/@next/swc-linux-x64-gnu/next-swc.linux-x64-gnu.node existed but error occurred while require it: not implemented
file: /home/projects/rlmizznwz.github/node_modules/@next/swc-linux-x64-musl/next-swc.linux-x64-musl.node existed but error occurred while require it: not implemented
error - failed to load SWC binary, see more info here: https://nextjs.org/docs/messages/failed-loading-swc Not sure if this belongs here or not, but I've posted it anyway. Let me know where I should post it, if not here. |
Beta Was this translation helpful? Give feedback.
-
doesn't work with docker on node:14-alpine.
Even when I disable swc with
|
Beta Was this translation helpful? Give feedback.
-
Hi, friends. Just as a heads up, upgrading to next 12.0.1 fixed my build issue with github actions + docker. 🎉 |
Beta Was this translation helpful? Give feedback.
-
doesnt work on
|
Beta Was this translation helpful? Give feedback.
-
Next version Getting Changing image to |
Beta Was this translation helpful? Give feedback.
-
Hi, We create a docker image for all of our Next.js websites so that we know all developers are on the same page technology-wise. And also to reduce the time of Here's our
However, now we receive these warnings during
And these errors during
And based on your link, we flagged all of our
and
But, we still get the same error. Thus Also we changed my
|
Beta Was this translation helpful? Give feedback.
-
Hi, I cannot build on linux/s390x,
error during build:
|
Beta Was this translation helpful? Give feedback.
-
Is there still no solution for this? My system data: $ node -e 'console.log(process.version, process.arch, process.platform)'
v20.13.1 arm linux
$ uname -a
Linux headlesspi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
$ lscpu
Architecture: aarch64
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
Vendor ID: ARM
Model: 3
Model name: Cortex-A72
Stepping: r0p3
CPU max MHz: 1800,0000
CPU min MHz: 600,0000
BogoMIPS: 108.00
L1d cache: 128 KiB
L1i cache: 192 KiB
L2 cache: 1 MiB
...
$ ./node_modules/next/dist/bin/next --version
Next.js v14.2.3
$ npm -v
10.5.2
$ npm run build
> gbox@0.1.0 build
> next build
▲ Next.js 14.2.3
- Environments: .env.local
✓ Linting and checking validity of types
Creating an optimized production build ...
Downloading swc package @next/swc-linux-arm-gnueabihf...
⨯ Failed to download swc package from https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-14.2.3.tgz
/home/kzi/gbox/node_modules/next/dist/lib/download-swc.js:98
throw new Error(`request failed with status ${res.status}`);
^
Error: request failed with status 404
at /home/kzi/gbox/node_modules/next/dist/lib/download-swc.js:98:23
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async extractBinary (/home/kzi/gbox/node_modules/next/dist/lib/download-swc.js:92:9)
at async downloadNativeNextSwc (/home/kzi/gbox/node_modules/next/dist/lib/download-swc.js:153:9)
at async tryLoadNativeWithFallback (/home/kzi/gbox/node_modules/next/dist/build/swc/index.js:292:5)
at async /home/kzi/gbox/node_modules/next/dist/build/swc/index.js:276:40
Node.js v20.13.1
> Build error occurred
Error: Jest worker encountered 1 child process exceptions, exceeding retry limit
at ChildProcessWorker.initialize (/home/kzi/gbox/node_modules/next/dist/compiled/jest-worker/index.js:1:11580)
at ChildProcessWorker._onExit (/home/kzi/gbox/node_modules/next/dist/compiled/jest-worker/index.js:1:12545)
at ChildProcess.emit (node:events:531:35)
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
type: 'WorkerError'
} As visible from the error, there was no swc binary downloaded, because trying to get it from https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-14.2.3.tgz returns a 404 error. I found a directory |
Beta Was this translation helpful? Give feedback.
-
Hi, I have this problem on FreeBSD: node -e 'console.log(process.version, process.arch, process.platform)' yarn next --version
This solution doesn't work for me:
|
Beta Was this translation helpful? Give feedback.
-
installing the Microsoft C++ Distribution 32bits or 64 bits according to your system is required. it's crucial for the project to start. after uninstalling my nodejs and reinstalling x64bits, My project successfully worked |
Beta Was this translation helpful? Give feedback.
-
Attempting to run on the IBM i which is currently not supported:
|
Beta Was this translation helpful? Give feedback.
-
Just trying to run the Next tutorial and encountered this mess ... hardly encouraging! Seems this issue has been going on since 2021 ... |
Beta Was this translation helpful? Give feedback.
-
Attempting to run in OpenBSD 7.5, and it says the same:
|
Beta Was this translation helpful? Give feedback.
-
I have same issue , I am tryig to build it in by github action with normal workflow . and get this error Run npm ci npm error code EBADPLATFORM |
Beta Was this translation helpful? Give feedback.
-
Attempting to deploy to Vercel (locally it all runs without an issue) and getting this error:
|
Beta Was this translation helpful? Give feedback.
-
I looked at The "solution" "If SWC continues to fail to load you can opt-out by disabling swcMinify in your next.config.js or by adding a .babelrc to your project with the following content:" Does not tell me HOW to disable swcMinify. Please CLEARIFY! (I am just an admin, trying to make the server run) Adding a .babel.rc file
Does not help AT ALL.
|
Beta Was this translation helpful? Give feedback.
-
Hi Next team, can you PLEASE provide the latest SWC package for swc-linux-arm-gnueabihf relatively quickly? Here's the output from docker build
|
Beta Was this translation helpful? Give feedback.
-
FreeBSD 14.1-RELEASE. Worked around with a .babelrc for a few steps, but fails further down the line (seems like babelrc is ignored). |
Beta Was this translation helpful? Give feedback.
-
I am getting the following on docker containers (node:20) in a fedora 40 machine. For some reason the same containers do work on my windows machine.
|
Beta Was this translation helpful? Give feedback.
-
Trying to build plex-rewind for
Full log https://github.com/RaunoT/plex-rewind/actions/runs/12164305317/job/33925637992 As already mentioned, the latest version of Already tried all the options mentioned in https://nextjs.org/docs/messages/failed-loading-swc as well as using a regular node:22 image to no avail. |
Beta Was this translation helpful? Give feedback.
-
This is a feedback thread for when your application fails to load the SWC binaries on a specific system.
Please provide:
node -e 'console.log(process.version, process.arch, process.platform)'
yarn next --version
yarn
ornpm
) and version@next/swc-<your-system-version>
was downloaded innode_modules
correctlyBeta Was this translation helpful? Give feedback.
All reactions