Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load SWC binary for linux/x64 #38436

Closed
1 task done
panghaoyuan opened this issue Jul 8, 2022 · 15 comments · Fixed by #38471
Closed
1 task done

Failed to load SWC binary for linux/x64 #38436

panghaoyuan opened this issue Jul 8, 2022 · 15 comments · Fixed by #38471

Comments

@panghaoyuan
Copy link

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
Platform: linux
Arch: x64
Version: #1 SMP Fri Dec 18 16:34:56 UTC 2020
Binaries:
Node: 16.15.1
npm: 8.11.0
Yarn: N/A
pnpm: 7.4.0
Relevant packages:
next: 12.2.1
eslint-config-next: 12.2.0
react: 17.0.2
react-dom: 16.14.0

What browser are you using? (if relevant)

Chrome 102

How are you deploying your application? (if relevant)

next start

Describe the Bug

my project in gitlab-ci(image: node:lts-buster) buid my app.
run next build
i get this error

info  - Skipping linting
info  - Creating an optimized production build...
info  - Downloading WASM swc package...
info  - Using experimental wasm build of next-swc
warn  - Attempted to load @next/swc-linux-x64-gnu, but it was not installed
warn  - Attempted to load @next/swc-linux-x64-gnux32, but it was not installed
warn  - Attempted to load @next/swc-linux-x64-musl, but an error occurred: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory
Failed to compile.```

how can i fix it

### Expected Behavior

null

### Link to reproduction

null

### To Reproduce

null
@panghaoyuan panghaoyuan added the bug Issue was opened via the bug report template. label Jul 8, 2022
@willemliufdmg
Copy link

I sometimes run into this bug as well and for me to bypass/fix this is to generate a package-lock.json on a similar architecture as the build runners. E.g. when I'm developing on Windows. I'll switch to WSL and generate the package-lock.json and commit that version instead of the one created while working in the Windows environment.

@balazsorban44 balazsorban44 added kind: bug and removed bug Issue was opened via the bug report template. labels Jul 8, 2022
@balazsorban44
Copy link
Member

I was able to reproduce it with pnpm create next-app 38436 && next dev

@RossMcMillan92
Copy link

Seeing this too when running tests in Jenkins CI.

@Kinbaum
Copy link
Contributor

Kinbaum commented Jul 8, 2022

I'm seeing something similar to this on 12.2.1 using a self-hosted actions runner:

info  - Downloading WASM swc package...
npm WARN config This command does not support workspaces.
warn  - Attempted to load @next/swc-linux-x64-gnu, but an error occurred: libssl.so.1.1: cannot open shared object file: No such file or directory
warn  - Attempted to load @next/swc-linux-x64-gnux32, but it was not installed
warn  - Attempted to load @next/swc-linux-x64-musl, but an error occurred: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory
warn  - Error: request failed with status 401
    at /app/node_modules/next/dist/lib/download-wasm-swc.js:124:23
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.downloadWasmSwc (/app/node_modules/next/dist/lib/download-wasm-swc.js:122:9)
    at async /app/node_modules/next/dist/build/swc/index.js:115:13
error - Failed to load SWC binary for linux/x64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc
ERROR: command finished with error: command (apps/laww) yarn run build exited (1)

@sspenst
Copy link

sspenst commented Jul 8, 2022

I'm also seeing this when trying to run next build on an EC2 server:

info  - Using experimental wasm build of next-swc
warn  - Attempted to load @next/swc-linux-x64-gnu, but an error occurred: libssl.so.1.1: cannot open shared object file: No such file or directory
warn  - Attempted to load @next/swc-linux-x64-gnux32, but it was not installed
warn  - Attempted to load @next/swc-linux-x64-musl, but an error occurred: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory
info  - Creating an optimized production build ...

The build seems to be stalling indefinitely.

@tmokmss
Copy link

tmokmss commented Jul 9, 2022

I'm seeing this issue even though I followed this document:

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:

@Rafcin
Copy link

Rafcin commented Jul 9, 2022

I'm also seeing this when trying to run next build on an EC2 server:

info  - Using experimental wasm build of next-swc
warn  - Attempted to load @next/swc-linux-x64-gnu, but an error occurred: libssl.so.1.1: cannot open shared object file: No such file or directory
warn  - Attempted to load @next/swc-linux-x64-gnux32, but it was not installed
warn  - Attempted to load @next/swc-linux-x64-musl, but an error occurred: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory
info  - Creating an optimized production build ...

The build seems to be stalling indefinitely.

Same here, not sure why this is happening 🤔. Have you tried to downgrade?

@pcho
Copy link

pcho commented Jul 9, 2022

Downgrade to 12.2.0 works fine.

@poad
Copy link

poad commented Jul 10, 2022

I had the same problem too, but I was able to take a temporary solution.
The version of OpenSSL installed on AmazonLinux 2 is 1.0.2, so I was able to solve the problem by installing OpenSSL 1.1.1.
I thought it would work by installing OpenSSL 1.1.1 in the same way in all Linux environments where OpenSSL 1.0.x is installed.

Example of installing OpenSSL 1.1.1 on AmazonLinux 2.

yum remove openssl-devel -y
yum install openssl11 openssl11-devel -y

@utenma
Copy link

utenma commented Jul 10, 2022

Downgrade to 12.2.0 works fine.

it does not on 22.04

@pcho
Copy link

pcho commented Jul 10, 2022

Downgrade to 12.2.0 works fine.

it does not on 22.04

I use 22.04 and it works fine for me. 🤯

@panghaoyuan
Copy link
Author

I fixed the bug, and by then I forgot to reply to this issue.
and the reason I had this problem was because, my gitlab image was chosen incorrectly, I chose the node:lts-alpine docker image in the pnpm install stage, but I chose node:lts-buster in the build stage and run next build, and when I unified the mirroring docker image to node:lts-alpine of the two stages, I fixed the problem.

rlenkov added a commit to rlenkov/rppd-app that referenced this issue Jul 29, 2022
@seongry
Copy link

seongry commented Aug 4, 2022

Hi, I have met this bugs and next downgrade wasn't working on me. But I solved the problem using another method, So I leave my comment here for another people like me.

If you turned on enableScript: false option on yarnrc.yml, then turn off the option. In my case, It's caused blocking install swc binary.

@tihuan
Copy link

tihuan commented Aug 19, 2022

12.2.5 without swcMinify works for us!

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.