Why is Next.js trying to load @next/swc-linux-arm64-gnu despite .babelrc being present?

71 views Asked by At

I am getting the error logs when trying to load a page in dev environment:

2024-03-11 17:17:06 yarn run v1.22.19
2024-03-11 17:17:06 $ next dev -p 4000
2024-03-11 17:17:10    Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc" https://nextjs.org/docs/messages/swc-disabled
2024-03-11 17:17:11   ▲ Next.js 13.5.6
2024-03-11 17:17:11   - Local:        http://localhost:4000
2024-03-11 17:17:11 
2024-03-11 17:17:11  ✓ Ready in 4.8s
2024-03-11 17:17:30    Using external babel configuration from /app/.babelrc
2024-03-11 17:17:33  ○ Compiling /middleware ...
2024-03-11 17:17:33 
2024-03-11 17:17:33 Done in 27.42s.
2024-03-11 17:17:30  ⚠ Attempted to load @next/swc-linux-arm64-gnu, but it was not installed
2024-03-11 17:17:30  ⚠ Attempted to load @next/swc-linux-arm64-musl, but it was not installed
2024-03-11 17:17:33  ⨯ Failed to load SWC binary for linux/arm64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc

The app is running in a docker container and I am using the exact same setup and code as my colleagues for whom this works. It has been working for me as well, and just stopped working without (knowingly) having changed anything.

Why is it trying to load the SWC binary in the first place when it clearly says that a .babelrc has been found? I have read through all the relevant places I could find for the topic but didn'T find my exact problem which is why I post it here.

// .babelrc
{
  "sourceType": "unambiguous",
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "chrome": 100
        }
      }
    ],
    "@babel/preset-typescript",
    "@babel/preset-react",
    "next/babel"
  ],
  "plugins": []
}

My setup:

OSX 13.5.2 M1

Node v16.17.1 arm64 darwin (tried 20.0.2 as well)

Next.js v13.5.6

Yarn 1.22.19

Places I checked so far:

nextjs.org info page

next github discussions

related SO question

0

There are 0 answers