Skip to content
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

Example progressive-web-app does not compile #22798

Closed
richardthombs opened this issue Mar 5, 2021 · 5 comments
Closed

Example progressive-web-app does not compile #22798

richardthombs opened this issue Mar 5, 2021 · 5 comments
Labels
bug Issue was opened via the bug report template. examples Issue was opened via the examples template.

Comments

@richardthombs
Copy link

What example does this report relate to?

progressive-web-app

What version of Next.js are you using?

Next.js v10.0.7

What version of Node.js are you using?

v14.15.5

What browser are you using?

Chrome

What operating system are you using?

Windows

How are you deploying your application?

npm run dev

Describe the Bug

Application fails to build and instead produces this error:

Error: Cannot find module 'webpack'
Require stack:
- C:\dev\pwa\node_modules\workbox-webpack-plugin\build\lib\get-manifest-entries-from-compilation.js
- C:\dev\pwa\node_modules\workbox-webpack-plugin\build\generate-sw.js
- C:\dev\pwa\node_modules\workbox-webpack-plugin\build\index.js
- C:\dev\pwa\node_modules\next-pwa\index.js
- C:\dev\pwa\next.config.js
- C:\dev\pwa\node_modules\next\dist\next-server\server\config.js
- C:\dev\pwa\node_modules\next\dist\next-server\server\next-server.js
- C:\dev\pwa\node_modules\next\dist\server\next.js
- C:\dev\pwa\node_modules\next\dist\server\lib\start-server.js
- C:\dev\pwa\node_modules\next\dist\cli\next-dev.js
- C:\dev\pwa\node_modules\next\dist\bin\next
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\dev\pwa\node_modules\workbox-webpack-plugin\build\lib\get-manifest-entries-from-compilation.js:12:5)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\dev\pwa\node_modules\workbox-webpack-plugin\build\generate-sw.js:24:43)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\dev\\pwa\\node_modules\\workbox-webpack-plugin\\build\\lib\\get-manifest-entries-from-compilation.js',
    'C:\\dev\\pwa\\node_modules\\workbox-webpack-plugin\\build\\generate-sw.js',
    'C:\\dev\\pwa\\node_modules\\workbox-webpack-plugin\\build\\index.js',
    'C:\\dev\\pwa\\node_modules\\next-pwa\\index.js',
    'C:\\dev\\pwa\\next.config.js',
    'C:\\dev\\pwa\\node_modules\\next\\dist\\next-server\\server\\config.js',
    'C:\\dev\\pwa\\node_modules\\next\\dist\\next-server\\server\\next-server.js',
    'C:\\dev\\pwa\\node_modules\\next\\dist\\server\\next.js',
    'C:\\dev\\pwa\\node_modules\\next\\dist\\server\\lib\\start-server.js',
    'C:\\dev\\pwa\\node_modules\\next\\dist\\cli\\next-dev.js',
    'C:\\dev\\pwa\\node_modules\\next\\dist\\bin\\next'
  ]
}

Expected Behavior

Application builds without errors

To Reproduce

npx create-next-app --example progressive-web-app pwa
cd pwa
npm run dev

@richardthombs richardthombs added bug Issue was opened via the bug report template. examples Issue was opened via the examples template. labels Mar 5, 2021
@timneutkens
Copy link
Member

Duplicate of #21679

This has been fixed in 10.0.8 (released yesterday) 🎉

@lvkins
Copy link

lvkins commented Mar 7, 2021

Duplicate of #21679

This has been fixed in 10.0.8 (released yesterday) 🎉

@timneutkens
Doesn't look like it's fixed. At least not completely. Just experienced similar issue regarding webpack. Been upgrading from 10.0.4 to 10.0.8.

Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
Require stack:
- app\node_modules\mini-css-extract-plugin\dist\loader.js
- app\node_modules\next\dist\compiled\webpack\bundle4.js
- app\node_modules\next\dist\compiled\webpack\webpack.js
- app\node_modules\next\dist\next-server\server\config-utils.js
- app\node_modules\next\dist\next-server\server\config.js
- app\node_modules\next\dist\next-server\server\next-server.js
- app\node_modules\next\dist\server\next.js
- app\node_modules\next\dist\server\lib\start-server.js
- app\node_modules\next\dist\cli\next-dev.js
- app\node_modules\next\dist\bin\next

@kachkaev
Copy link
Contributor

kachkaev commented Mar 24, 2021

Same issue in next 10.0.9 after upgrading from 10.0.4.

Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
Require stack:
- /path/to/project/node_modules/extract-css-chunks-webpack-plugin/dist/loader.js
- /path/to/project/node_modules/next/dist/compiled/webpack/bundle4.js
- /path/to/project/node_modules/next/dist/compiled/webpack/webpack.js
- /path/to/project/node_modules/next/dist/next-server/server/config-utils.js
- /path/to/project/node_modules/next/dist/next-server/server/config.js
- /path/to/project/node_modules/next/dist/next-server/server/next-server.js
- /path/to/project/node_modules/next/dist/server/next.js
- /path/to/project/node_modules/next/dist/server/lib/start-server.js
- /path/to/project/node_modules/next/dist/cli/next-dev.js
- /path/to/project/node_modules/next/dist/bin/next
overrideMethod @ react_devtools_backend.js:2430
handleErrors @ hot-dev-client.js?647e:162
processMessage @ hot-dev-client.js?647e:208
eval @ hot-dev-client.js?647e:54
eval @ eventsource.js?9b42:39
handleMessage @ eventsource.js?9b42:37

UPD: I was able to fix this via yarn add webpack@webpack-4.

@haiifeng
Copy link

@kachkaev thank you very much.
that helps me.

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. examples Issue was opened via the examples template.
Projects
None yet
Development

No branches or pull requests

6 participants