nextjs - 💡(How to fix) Fix The @next/swc-win32-x64-msvc package seems to conflict with the pnpm environment. [2 comments, 3 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#86872Fetched 2026-04-08 02:08:41
View on GitHub
Comments
2
Participants
3
Timeline
8
Reactions
0
Author
Timeline (top)
commented ×2labeled ×2closed ×1issue_type_added ×1

Error Message

C:\nextjs-project> next start

The module 'react' was not found. Next.js requires that you include it in 'dependencies' of your 'package.json'. To add it, run 'npm install react' The module 'react-dom' was not found. Next.js requires that you include it in 'dependencies' of your 'package.json'. To add it, run 'npm install react-dom' node:internal/modules/cjs/loader:1383 const err = new Error(message); ^

Error: Cannot find module 'react'

Root Cause

After trying several times, I suspect this problem may be caused by the @next/swc-win32-x64-msvc component. Because this problem does not occur after I deploy this project to a Linux server. The biggest difference between these two environments is that I didn’t install the @next/swc-win32-x64-msvc component on the Linux server (because it’s not compatible with the Linux environment). But on Windows 11, even when executing the same command, it still failed. However, when I switched the Node package manager to npm, this problem disappeared. So I speculate that this might be due to a conflict between the @next/swc-win32-x64-msvc package and pnpm.

Code Example

C:\nextjs-project> next start

The module 'react' was not found. Next.js requires that you include it in 'dependencies' of your 'package.json'. To add it, run 'npm install react'
The module 'react-dom' was not found. Next.js requires that you include it in 'dependencies' of your 'package.json'. To add it, run 'npm install react-dom'
node:internal/modules/cjs/loader:1383
  const err = new Error(message);
              ^

Error: Cannot find module 'react'

---

Operating System:
  Platform: Windows 11
  Arch: x64
  Version: Windows 11 23H2 (22631.4751)

Binaries:
  Nodejs: v22.20.0
  pnpm: 10.21.0
  next: 15.5.7
  react: 19.2.0
  react-dom: 19.2.0
  @next/swc-win32-x64-msvc: 15.5.6
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/aquaori/nextjs-swc-pnpm-conflic

To Reproduce

Copy the package.json to a new Next.js project, then run pnpm install to reproduce this issue.

Current vs. Expected behavior

The @next/swc-win32-x64-msvc package seems to conflict with the pnpm environment:

C:\nextjs-project> next start

The module 'react' was not found. Next.js requires that you include it in 'dependencies' of your 'package.json'. To add it, run 'npm install react'
The module 'react-dom' was not found. Next.js requires that you include it in 'dependencies' of your 'package.json'. To add it, run 'npm install react-dom'
node:internal/modules/cjs/loader:1383
  const err = new Error(message);
              ^

Error: Cannot find module 'react'

After trying several times, I suspect this problem may be caused by the @next/swc-win32-x64-msvc component. Because this problem does not occur after I deploy this project to a Linux server. The biggest difference between these two environments is that I didn’t install the @next/swc-win32-x64-msvc component on the Linux server (because it’s not compatible with the Linux environment). But on Windows 11, even when executing the same command, it still failed. However, when I switched the Node package manager to npm, this problem disappeared. So I speculate that this might be due to a conflict between the @next/swc-win32-x64-msvc package and pnpm.

Provide environment information

Operating System:
  Platform: Windows 11
  Arch: x64
  Version: Windows 11 23H2 (22631.4751)

Binaries:
  Nodejs: v22.20.0
  pnpm: 10.21.0
  next: 15.5.7
  react: 19.2.0
  react-dom: 19.2.0
  @next/swc-win32-x64-msvc: 15.5.6

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

SWC

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

next start (local)

Additional context

No response

extent analysis

TL;DR

The issue can likely be resolved by removing or updating the @next/swc-win32-x64-msvc package to ensure compatibility with pnpm on Windows 11.

Guidance

  • Verify the issue by checking if the error persists when using npm instead of pnpm, as the problem seems to be related to the package manager.
  • Try removing the @next/swc-win32-x64-msvc package and see if the issue resolves, as it's suspected to be the cause of the conflict.
  • Check the compatibility of the @next/swc-win32-x64-msvc package with pnpm and Windows 11, and consider updating to a version that is known to work.
  • If the issue persists, try reinstalling the react and react-dom packages using pnpm to ensure they are properly installed.

Example

No code snippet is provided as the issue seems to be related to package management and compatibility rather than code-specific issues.

Notes

The issue may be specific to the combination of pnpm, Windows 11, and the @next/swc-win32-x64-msvc package, so the solution may not apply to other environments or package managers.

Recommendation

Apply workaround: Remove or update the @next/swc-win32-x64-msvc package to ensure compatibility with pnpm on Windows 11, as this seems to be the most likely cause of the issue.

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 - 💡(How to fix) Fix The @next/swc-win32-x64-msvc package seems to conflict with the pnpm environment. [2 comments, 3 participants]