-
Notifications
You must be signed in to change notification settings - Fork 30k
Description
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.6Which 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