nextjs - ✅(Solved) Fix Failed to load external module with turbopack [1 pull requests, 1 comments, 2 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#86652Fetched 2026-04-08 02:10:00
View on GitHub
Comments
1
Participants
2
Timeline
12
Reactions
0
Timeline (top)
labeled ×3cross-referenced ×2closed ×1commented ×1

Error Message

⨯ Error: Failed to load external module @aws-sdk/client-s3-ecbef8e33fd0b8f0: Error: Cannot find module '@aws-sdk/client-s3-ecbef8e33fd0b8f0'

Fix Action

Fixed

PR fix notes

PR #86697: Turbopack: normalize distDir separators

Description (problem / solution / changelog)

Closes #86652 Closes PACK-6023

Previously, dist_dir contained backslashes on Windows which broke various things (among them, relative paths for the externals symlinks):

https://github.com/vercel/next.js/blob/6eed9a05450f2c179b951c97350e305973a09e6f/crates/next-api/src/project.rs#L765

Changed files

  • packages/next/src/build/swc/index.ts (modified, +24/-7)

Code Example

Error: Failed to load external module @aws-sdk/client-s3-ecbef8e33fd0b8f0: Error: Cannot find module '@aws-sdk/client-s3-ecbef8e33fd0b8f0'

---

Error: Failed to load external module @aws-sdk/client-s3-ecbef8e33fd0b8f0: BuildMessage: ENOENT reading "C:\{path_to_project}\.next\dev\node_modules\@aws-sdk\client-s3-ecbef8e33fd0b8f0"

---

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 65451
  Available CPU cores: 16
Binaries:
  Node: 23.10.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 10.7.0
Relevant Packages:
  next: 16.1.0-canary.4 // Latest available version is detected (16.1.0-canary.4).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  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/Haaxor1689/next-turbopack-issue-repro

To Reproduce

  1. Start the app in dev mode

Current vs. Expected behavior

You get following error when importing anything from "@aws-sdk/client-s3".

⨯ Error: Failed to load external module @aws-sdk/client-s3-ecbef8e33fd0b8f0: Error: Cannot find module '@aws-sdk/client-s3-ecbef8e33fd0b8f0'

The error has a slightly different message in my bun project where I encountered it initially.

⨯ Error: Failed to load external module @aws-sdk/client-s3-ecbef8e33fd0b8f0: BuildMessage: ENOENT reading "C:\{path_to_project}\.next\dev\node_modules\@aws-sdk\client-s3-ecbef8e33fd0b8f0"

There should be no error when importing this module.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 65451
  Available CPU cores: 16
Binaries:
  Node: 23.10.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 10.7.0
Relevant Packages:
  next: 16.1.0-canary.4 // Latest available version is detected (16.1.0-canary.4).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  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 dev (local)

Additional context

This bug seems to have been introduced in 16.1.0-canary.3 since reverting to 16.1.0-canary.2 works.

extent analysis

TL;DR

Reverting to Next.js version 16.1.0-canary.2 may resolve the issue with importing @aws-sdk/client-s3 due to a potential bug introduced in 16.1.0-canary.3.

Guidance

  • Verify that the issue is indeed caused by the version of Next.js by testing with 16.1.0-canary.2 as mentioned in the additional context.
  • Check if there are any known issues or fixes related to Turbopack and module loading in the Next.js repository or documentation.
  • Consider reporting the issue to the Next.js team if reverting to an earlier version is not a viable long-term solution.
  • Test if the issue persists when using a different package manager (e.g., switching from pnpm to npm or yarn) to rule out package manager-specific issues.

Example

No specific code example is provided as the issue seems to be related to a version-specific bug in Next.js rather than a coding error.

Notes

The solution provided is based on the information given in the issue and may not be applicable if the environment or versions differ significantly. It's also worth noting that reverting to an earlier version of Next.js might introduce other compatibility issues with other dependencies.

Recommendation

Apply workaround: Revert to Next.js version 16.1.0-canary.2 as it has been confirmed to work in the provided context. This is recommended because it provides a known working solution, albeit temporary, until a fix for the bug in 16.1.0-canary.3 and later versions is released.

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