nextjs - ✅(Solved) Fix Failed to load external module styled-components after updating to version 16.1.0 [1 pull requests, 20 comments, 8 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#87686Fetched 2026-04-08 02:06:35
View on GitHub
Comments
20
Participants
8
Timeline
57
Reactions
1
Author
Timeline (top)
subscribed ×22commented ×20mentioned ×7cross-referenced ×5

Error Message

Error: Failed to load external module styled-components-bd377d8093d58039: Error: Cannot find module 'styled-components-bd377d8093d58039' When running the command npm run dev, another error is shown: Error [TurbopackInternalError]: failed to create symlink to ../../../node_modules/styled-components In version 16.0.10 it works normally, but in version 16.1.0 or 16.1.1 (the latest version at the time of test) the error is appearing. After updating from version 16.0.10 (turbopack) to 16.1.0 or 16.1.1, after the build and start commands, when accessing the website the following error occurs: Error: Failed to load external module styled-components-bd377d8093d58039: Error: Cannot find module 'styled-components-bd377d8093d58039'.

Fix Action

Fixed

PR fix notes

PR #7064: fix(next): correction de l'erreur empêchant next de fonctionner en v16.1

Description (problem / solution / changelog)

Links to https://github.com/vercel/next.js/issues/87686 Links to https://github.com/vercel/next.js/issues/87737

Changed files

  • .npmrc (modified, +15/-0)
  • packages/code-du-travail-frontend/cypress/integration/light/outils/brut-net.spec.ts (modified, +29/-53)
  • packages/code-du-travail-frontend/next.config.mjs (modified, +6/-2)
  • packages/code-du-travail-frontend/package.json (modified, +2/-4)
  • pnpm-lock.yaml (modified, +322/-304)

Code Example

Operating System:
  Platform: linux
  Arch: x64
  Version: #17-Ubuntu SMP Mon Sep  2 13:48:07 UTC 2024
  Available memory (MB): 958
  Available CPU cores: 1
Binaries:
  Node: 24.11.1
  npm: 11.6.4
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.1.1
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/Aluisio/test-styled-components

To Reproduce

  1. Build in the local development environment
  2. Send the .next folder to the server
  3. npm run start

Error: Failed to load external module styled-components-bd377d8093d58039: Error: Cannot find module 'styled-components-bd377d8093d58039' Require stack:

  • /home/ubuntu/front-end/.next/server/chunks/ssr/[root-of-the-server]__33cb3701._.js
  • /home/ubuntu/front-end/.next/server/chunks/ssr/[turbopack]_runtime.js
  • /home/ubuntu/front-end/.next/server/pages/_document.js
  • /home/ubuntu/front-end/node_modules/next/dist/server/require.js
  • /home/ubuntu/front-end/node_modules/next/dist/server/load-components.js
  • /home/ubuntu/front-end/node_modules/next/dist/build/utils.js
  • /home/ubuntu/front-end/node_modules/next/dist/build/swc/options.js
  • /home/ubuntu/front-end/node_modules/next/dist/build/swc/index.js
  • /home/ubuntu/front-end/node_modules/next/dist/build/next-config-ts/transpile-config.js
  • /home/ubuntu/front-end/node_modules/next/dist/server/config.js
  • /home/ubuntu/front-end/node_modules/next/dist/cli/next-test.js
  • /home/ubuntu/front-end/node_modules/next/dist/bin/next at Context.externalRequire [as x] (.next/server/chunks/ssr/[turbopack]runtime.js:535:15) at module evaluation (.next/server/chunks/ssr/[root-of-the-server]__33cb3701..js:2:13032) at instantiateModule (.next/server/chunks/ssr/[turbopack]_runtime.js:740:9) at getOrInstantiateModuleFromParent (.next/server/chunks/ssr/[turbopack]_runtime.js:763:12) at Context.esmImport [as i] (.next/server/chunks/ssr/[turbopack]runtime.js:228:20) at module evaluation (.next/server/chunks/ssr/[root-of-the-server]__1c13cba3..js:7:2777) at instantiateModule (.next/server/chunks/ssr/[turbopack]_runtime.js:740:9) at instantiateRuntimeModule (.next/server/chunks/ssr/[turbopack]_runtime.js:768:12) at getOrInstantiateRuntimeModule (.next/server/chunks/ssr/[turbopack]_runtime.js:781:12) at Object.m (.next/server/chunks/ssr/[turbopack]_runtime.js:790:18)

When running the command npm run dev, another error is shown: Error [TurbopackInternalError]: failed to create symlink to ../../../node_modules/styled-components

In my case, I can't run npm run build on the server, so I send the .next folder separately. Up to version 16.0.10 this worked normally.

Current vs. Expected behavior

In version 16.0.10 it works normally, but in version 16.1.0 or 16.1.1 (the latest version at the time of test) the error is appearing.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #17-Ubuntu SMP Mon Sep  2 13:48:07 UTC 2024
  Available memory (MB): 958
  Available CPU cores: 1
Binaries:
  Node: 24.11.1
  npm: 11.6.4
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.1.1
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

next start (local)

Additional context

After updating from version 16.0.10 (turbopack) to 16.1.0 or 16.1.1, after the build and start commands, when accessing the website the following error occurs: Error: Failed to load external module styled-components-bd377d8093d58039: Error: Cannot find module 'styled-components-bd377d8093d58039'.

This problem started in version 16.1.0. My environment is Ubuntu on an AWS EC2 server, Turbopack, and PM2 Turbopack version: d1bd5b58

extent analysis

TL;DR

The issue can be resolved by downgrading Next.js to version 16.0.10 or by finding an alternative solution to the Turbopack symlink issue.

Guidance

  • The error message suggests a problem with loading the styled-components module, which may be related to the Turbopack configuration or the way the .next folder is being generated and served.
  • The fact that the issue started in version 16.1.0 and the error message mentions a failed symlink creation suggests that there may be a compatibility issue with the new version of Next.js and Turbopack.
  • Try downgrading Next.js to version 16.0.10 to see if the issue is resolved.
  • If downgrading is not an option, investigate the Turbopack configuration and the way the .next folder is being generated and served to see if there are any changes that can be made to resolve the issue.

Example

No code example is provided as the issue seems to be related to the configuration and versioning of the dependencies rather than a specific code snippet.

Notes

The issue may be specific to the combination of Next.js version 16.1.1, Turbopack, and the way the .next folder is being generated and served. Further investigation into the Turbopack configuration and the build process may be necessary to resolve the issue.

Recommendation

Apply workaround: Downgrade Next.js to version 16.0.10. This is because the issue started in version 16.1.0 and downgrading to a previous version may resolve the compatibility issue with Turbopack.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - ✅(Solved) Fix Failed to load external module styled-components after updating to version 16.1.0 [1 pull requests, 20 comments, 8 participants]