pnpm: ERR_MODULE_NOT_FOUND react/jsx-runtime
I use pnpm to solve some npm dependencies bugs but now I cannot import react-daisyui.
Error
➜ my-project-name git:(dark-mode) ✗ npm run dev
> [email protected] dev
> next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Loaded env from /home/indicozy/Documents/Projects/oponai/my-project-name/.env
node:internal/process/promises:279
triggerUncaughtException(err, true /* fromPromise */);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/indicozy/Documents/Projects/oponai/my-project-name/node_modules/.pnpm/[email protected]_tgktzqjq2hhcpfjfdazojt3jfa/node_modules/react/jsx-runtime' imported from /home/indicozy/Documents/Projects/oponai/my-project-name/node_modules/.pnpm/[email protected]_tgktzqjq2hhcpfjfdazojt3jfa/node_modules/react-daisyui/dist/react-daisyui.modern.js
Did you mean to import [email protected]/node_modules/react/jsx-runtime.js?
at new NodeError (node:internal/errors:372:5)
at finalizeResolution (node:internal/modules/esm/resolve:437:11)
at moduleResolve (node:internal/modules/esm/resolve:1009:10)
at defaultResolve (node:internal/modules/esm/resolve:1218:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:80:40)
at link (node:internal/modules/esm/module_job:78:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
Stack: NextJS v12.1.6, React v17.0.2, daisyui v2.15.3, react-daisyui v2.0.3
Hi @indicozy,
I'll be looking into this further, sorry for the delay. I'm not too familiar with pnpm so apologies for not testing whether or not it would work with pnpm.
I'll keep you updated here whenever I find a fix!
Hi, @benjitrosch Gotcha, feel free to tag me if you need more info!
im using yarn and have the same issue, any update?
I'm having the same issue with pnpm
Hi @macklinhrw, I do not have the issue with pnpm.
What versions of the following packages are you using?
- react
- react-dom
- react-daisyui
- @types/react
- @types/react-dom
- typescript
As far as I understand the problem, it is a mismatch between typescript, react, react-dom and @types/react. Lets see if we can figure this out :)
Thank you,
I was able to fix the issue after updating react.
My React version before the update was: v17 whereas the latest version is v18.2.0