-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compatibility issue: Next.js 15 and React Three Fiber - TypeError: Cannot read properties of undefined (reading 'ReactCurrentOwner') #71836
Comments
Next.js 15 is using React 19. React 19 changes its secret internal API from React Three Fiber uses those React secret internals to access This is not the issue of React or Next.js, it is a bug of React Three Fiber. Please submit an issue there instead. |
@kjwrld better downgrade to [email protected] |
See also: pmndrs/react-three-fiber#3222 |
I also having the issue using react 18 - so this seems to be not strictly related to a newer react version (I also tried 18.2, 18.3 and 19) - all with the same error happening once nextjs 15 is installed |
Because Next.js will prefer its built-in version of React rather than your installed version. |
@kjwrld have you tried It seems that some users are having success with that and Next.js 15: |
This comment was marked as off-topic.
This comment was marked as off-topic.
Need to use the 9 beta. Potential related issue: vercel/next.js#71836
I downgraded the React version to 18, and the issue was resolved. npm install react@18
npm install react-dom@18 |
i have solved it by downgrade my next.js to 14.2 and remove turbopack from the package.json and insure that next.config.ts to be next.config.js |
Link to the code that reproduces this issue
https://github.com/frommybrain/r3f-starter
To Reproduce
To Reproduce:
create-next-app
next dev
)Current vs. Expected behavior
Current behavior: When trying to render a React Three Fiber component in a Next.js 15 application, the following error occurs:
Expected behavior: The React Three Fiber component should render without errors, as it does in previous versions of Next.js.
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000 Available memory (MB): 32768 Available CPU cores: 10 Binaries: Node: 18.19.0 npm: 10.2.3 Yarn: 1.22.22 pnpm: N/A Relevant Packages: next: 15.0.1 // Latest available version is detected (15.0.1). eslint-config-next: N/A react: 18.3.1 react-dom: 18.3.1 typescript: N/A Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
create-next-app, Developer Experience
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local), next start (local)
Additional context
This issue appears to be specific to Next.js 15 and its interaction with React Three Fiber. The error suggests a problem with React's internal workings, possibly due to changes in Next.js 15's handling of React or its bundling process. The issue occurs in the development environment and prevents the application from rendering properly.
It would be helpful to investigate any changes in Next.js 15 that might affect how it interacts with React's internals or how it bundles React-based libraries like React Three Fiber.
TypeError: Cannot read properties of undefined (reading 'ReactCurrentOwner')
The text was updated successfully, but these errors were encountered: