next.js: Nextjs 13.4.9 - Error: Cannot find module 'webpack'
Verify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000
Binaries:
Node: 18.16.1
npm: 9.5.1
Yarn: 1.22.19
pnpm: 8.6.6
Relevant Packages:
next: 13.4.9-canary.3
eslint-config-next: 13.4.9
react: 18.2.0
react-dom: 18.2.0
typescript: 5.1.6
Next.js Config:
output: N/A
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue or a replay of the bug
https://github.com/alifa20/next-js-demo/pull/1
To Reproduce
- Git pull the repo
- yarn && yarn dev
- Try browsing localhost:3000
- The error will come up in the console
Describe the Bug
I have a suspicion that this issue may be related to the following GitHub links:
- https://github.com/vercel/next.js/issues/21679
- https://github.com/shadowwalker/next-pwa/issues/151 🤷♂️ ¯\(ツ)/¯
It’s unclear at the moment, so I’m not entirely certain. However, the older version, v13.4.8, seems to be functioning properly.
Expected Behavior
Localhost:3000 should come up.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 9
- Comments: 19 (8 by maintainers)
I’m using NextJS
13.4.9
in my case I justyarn add -D webpack
webpack as a devDependency.1 First thing I did, still worked 2-4 thanks! 5-7 no,
next
comes withwebpack
prebundled, so you should definitely not need to install it yourself. This sounds like a bug, will look, more into it. (@luizeboli thats true for you too,webpack
should not be added as a dependency)@alifa20 I will wait for 13.4.10 to release first, then revert later with a note in
next-pwa
’s docs 😃@DuCanhGH Your suggested version definitely fixed the issue with existing next.js v13.4.9 .
Thanks for jumping in and updating this issue thread 🙏
Also thanks to @shuding that his PR seems to fix the issue for v13.4.10-canary.5 Also the latest version of both libraries work together as well.
✅ Link to the commit of the fix next-pwa 9.2.1, next.js v13.4.9 ✅ Link to the commit of the fix next-pwa ^9.1.4, next.js v13.4.10-canary.5 ✅ Link to the commit of the fix next-pwa 9.2.1, next.js v13.4.10-canary.5
@balazsorban44 Thanks for the reply.
I believe the stack error is very similar to what @Marcus-Rise has mentioned actually.
next-pwa
fromnext.config.js
seems to make the error go away. 👍@ducanh2912/next-pwa
as you suggested, but still same error. ❌yarn add -D -E webpack
it seems like it fixes the issue. You don’t see the error, it might be because you have installed webpack globally? ¯\(ツ)/¯ 🤷♂️next
repo: https://github.com/vercel/next.js/compare/v13.4.8…v13.4.9#diff-5f0a6c7f8a0c0b2d7e6c0f5a8e5b7a9b6d8b3f9d3e7c2a2d5f0c9a5b8e1c6f6 seems like one of the PRs have made the project need to have webpack installed separately. My guess is this pr https://github.com/vercel/next.js/pull/52186/files#diff-5f0a6c7f8a0c0b2d7e6c0f5a8e5b7a9b6d8b3f9d3e7c2a2d5f0c9a5b8e1c6f6R54 PR link: https://github.com/vercel/next.js/pull/52186@balazsorban44 I’m also experiencing this error using the library https://github.com/dlehmhus/next-with-linaria. At least for me the error starts in release
v13.4.9-canary.3
.https://github.com/vercel/next.js/compare/v13.4.9-canary.2...v13.4.9-canary.3