stackblitz / webcontainer-core

Dev environments. In your web app.
https://webcontainers.io
MIT License
3.94k stars 174 forks source link

Bug: NextJS based project does not boot up anymore #1489

Open mirko314 opened 4 months ago

mirko314 commented 4 months ago

Describe the bug

The following error occurs when opening the stackblitz:

 yarn install && npx next dev
yarn install v1.22.19
[1/4] 🔍  Resolving packages...
success Already up-to-date.
✨  Done in 0.90s.
  ▲ Next.js 14.2.4
  - Local:        http://localhost:3000
  - Environments: .env

 ✓ Starting...
 ⚠ Attempted to load @next/swc-linux-x64-gnu, but an error occurred: Cannot load native addon because loading addons is disabled: /home/projects/imgly-cesdk-web-examples-sgnxde/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/projects/imgly-cesdk-web-examples-sgnxde/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

Link to the blitz that caused the error

https://stackblitz.com/edit/imgly-cesdk-web-examples-sgnxde?file=src%2Fcomponents%2Fcase%2FCaseComponent.jsx&title=IMG.LY%20CE.SDK:%20Background%20Removal%20Plugin

Steps to reproduce

  1. Open the example stackblitz
  2. The default yarn install && npx next dev fails with the error specified above.

Expected behavior

I expect that the NextJS app boots up normally

Parity with Local

Screenshots

No response

Platform

Browser name  = Chrome
Full version  = 127.0.0.0
Major version = 127
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
performance.memory = {
  "totalJSHeapSize": 86616173,
  "usedJSHeapSize": 80210953,
  "jsHeapSizeLimit": 4294705152
}
Hash = 41692973

Additional context

No response

sulco commented 3 months ago

Hey @mirko314, I've just tried the reproduction and it does error out on the SWC binary, but after bumping next from 14.2.4 to 14.2.5 it passes through. I know that the Next team was making some adjustments to how SWC is treated, so looks like this might have been fixed upstream. Can you confirm if this works for you?