Error with package path jsx-runtime updating Nextjs with React 18
See original GitHub issueI tried updating my website with React 18 (Nextjs v12.1.2) and not compiling. The error is:
wait - compiling...
error - ./node_modules/next-contentlayer/dist/hooks/useMDXComponent.js:5:0
Module not found: Package path ./jsx-runtime.js is not exported from package /.../me/nikosantis.dev/node_modules/react (see exports field in /.../me/nikosantis.dev/node_modules/react/package.json)
Import trace for requested module:
./node_modules/next-contentlayer/dist/hooks/index.js
./pages/sobre-mi.tsx
https://nextjs.org/docs/messages/module-not-found
I tested changing the jsx_runtime
import in useMDXComponent
in node_modules
and compiled again.
from:
import * as _jsx_runtime from 'react/jsx-runtime.js'
to:
import * as _jsx_runtime from 'react/jsx-runtime'
Working with this change without errors 😎 idk why…
I tried this change in the contentlayer
repo (feat/0.2.0 branch), yarn build
and yarn test
and all tests passed 💯
Can you check that?
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Issues - GitHub
I am running react-dnd@15.1.2 and I am getting this error: Module not found: Error: Package path ./jsx-runtime.js is not exported from ...
Read more >got Can't resolve 'react/jsx-runtime' error while use try to create ...
Updating your react version possibily can resolve your problem. Command line: npm install --save react@latest.
Read more >React 18: Switchable Runtime - Next.js
Learn more about the switchable runtimes (Edge and Node.js) in Next.js. ... Next.js has two server runtimes where you can render parts of...
Read more >Module not found: Can't resolve 'react/jsx-runtime' | bobbyhadz
To solve the error "Module not found: Error: Can't resolve 'react/jsx-runtime'", make sure to update the react package by opening your terminal in...
Read more >react-dnd 16.0.0 and DnDProvider.js : r/reactjs - Reddit
js '? BREAKING CHANGE: The request 'react/jsx-runtime' failed to resolve only because it was resolved as fully specified (probably because the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Anyone else still having troubles with it, after updating to latest release? I upgraded Next, React and Content Layer (all to latest), fixed the Next config file and I still get the same error.
Update: I think I found a “solution” aka functioning work-around for this problem:
Will be released with the upcoming
0.2.0
release.