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

Cannot find module 'webpack' upgrade from 0.28.0 to 0.28.1 #686

Closed
tonyhallett opened this issue Apr 7, 2021 · 10 comments · Fixed by #692
Closed

Cannot find module 'webpack' upgrade from 0.28.0 to 0.28.1 #686

tonyhallett opened this issue Apr 7, 2021 · 10 comments · Fixed by #692
Labels
bug Something isn't working

Comments

@tonyhallett
Copy link

Using in a github actions repo.

Below output from dependabot but occurring locally as well
https://github.com/tonyhallett/artifacts-url-comments/pull/8/checks?check_run_id=2287289635

> ncc build --source-map --license licenses.txt

ncc: Version 0.28.1
ncc: Compiling file index.js
HookWebpackError: Cannot find module 'webpack'
Require stack:
- /home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js
- /home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/cli.js
    at makeWebpackError (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:320193)
    at /home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:144666
    at eval (eval at create (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:20:117070), <anonymous>:13:1)
    at fn (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:116235)
    at _next1 (eval at create (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:20:117070), <anonymous>:11:1)
    at eval (eval at create (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:20:117070), <anonymous>:27:1)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
-- inner error --
Error: Cannot find module 'webpack'
Require stack:
- /home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js
- /home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at WebpackModuleFileIterator.resolve [as requireResolve] (internal/modules/cjs/helpers.js:94:19)
    at WebpackModuleFileIterator.getActualFilename (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:951349)
    at WebpackModuleFileIterator.internalCallback (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:951052)
    at WebpackModuleFileIterator.iterateFiles (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:950726)
    at /home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:934018
    at WebpackChunkModuleIterator.iterateModules (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:944891)
    at PluginChunkReadHandler.processChunk (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:933969)
    at _loop_1 (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:947680)
    at WebpackCompilerHandler.iterateChunks (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:948545)
caused by plugins in Compilation.hooks.processAssets
Error: Cannot find module 'webpack'
Require stack:
- /home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js
- /home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at WebpackModuleFileIterator.resolve [as requireResolve] (internal/modules/cjs/helpers.js:94:19)
    at WebpackModuleFileIterator.getActualFilename (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:951349)
    at WebpackModuleFileIterator.internalCallback (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:951052)
    at WebpackModuleFileIterator.iterateFiles (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:950726)
    at /home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:934018
    at WebpackChunkModuleIterator.iterateModules (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:944891)
    at PluginChunkReadHandler.processChunk (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:933969)
    at _loop_1 (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:947680)
    at WebpackCompilerHandler.iterateChunks (/home/runner/work/artifacts-url-comments/artifacts-url-comments/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:948545)
@pataruco
Copy link

pataruco commented Apr 7, 2021

I have the same problem:
> yarn ncc build ./src/index.ts --minify --license licenses.txt

ncc: Version 0.28.1
ncc: Compiling file index.js
ncc: Using [email protected] (local user-provided)
HookWebpackError: Cannot find module 'webpack'
Require stack:
- /Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js
- /Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/cli.js
    at makeWebpackError (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:320193)
    at /Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:144666
    at eval (eval at create (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:20:117070), <anonymous>:11:1)
    at fn (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:116235)
    at _next0 (eval at create (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:20:117070), <anonymous>:9:1)
    at eval (eval at create (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:20:117070), <anonymous>:24:1)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
-- inner error --
Error: Cannot find module 'webpack'
Require stack:
- /Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js
- /Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at WebpackModuleFileIterator.resolve [as requireResolve] (internal/modules/cjs/helpers.js:80:19)
    at WebpackModuleFileIterator.getActualFilename (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:951349)
    at WebpackModuleFileIterator.internalCallback (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:951052)
    at WebpackModuleFileIterator.iterateFiles (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:950726)
    at /Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:934018
    at WebpackChunkModuleIterator.iterateModules (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:944891)
    at PluginChunkReadHandler.processChunk (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:933969)
    at _loop_1 (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:947680)
    at WebpackCompilerHandler.iterateChunks (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:948545)
caused by plugins in Compilation.hooks.processAssets
Error: Cannot find module 'webpack'
Require stack:
- /Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js
- /Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at WebpackModuleFileIterator.resolve [as requireResolve] (internal/modules/cjs/helpers.js:80:19)
    at WebpackModuleFileIterator.getActualFilename (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:951349)
    at WebpackModuleFileIterator.internalCallback (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:951052)
    at WebpackModuleFileIterator.iterateFiles (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:950726)
    at /Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:934018
    at WebpackChunkModuleIterator.iterateModules (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:944891)
    at PluginChunkReadHandler.processChunk (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:933969)
    at _loop_1 (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:947680)
    at WebpackCompilerHandler.iterateChunks (/Users/pataruco/development/continous-compliance/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:948545)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@nogic1008
Copy link

It still reproduces in v0.28.2

@Bruce17
Copy link

Bruce17 commented Apr 8, 2021

I have the same problem for v0.28.1 and now for v0.28.2

[email protected] prepare /home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version
> ncc build src/index.js -o dist --source-map --license licenses.txt

ncc: Version 0.28.2
ncc: Compiling file index.js
HookWebpackError: Cannot find module 'webpack'
Require stack:
- /home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js
- /home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/cli.js
    at makeWebpackError (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:320193)
    at /home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:144666
    at eval (eval at create (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:20:117070), <anonymous>:13:1)
    at fn (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:116235)
    at _next1 (eval at create (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:20:117070), <anonymous>:11:1)
    at eval (eval at create (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:20:117070), <anonymous>:27:1)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
-- inner error --
Error: Cannot find module 'webpack'
Require stack:
- /home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js
- /home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at WebpackModuleFileIterator.resolve [as requireResolve] (internal/modules/cjs/helpers.js:94:19)
    at WebpackModuleFileIterator.getActualFilename (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:951366)
    at WebpackModuleFileIterator.internalCallback (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:951069)
    at WebpackModuleFileIterator.iterateFiles (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:950743)
    at /home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:934035
    at WebpackChunkModuleIterator.iterateModules (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:944908)
    at PluginChunkReadHandler.processChunk (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:933986)
    at _loop_1 (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:947697)
    at WebpackCompilerHandler.iterateChunks (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:948562)
caused by plugins in Compilation.hooks.processAssets
Error: Cannot find module 'webpack'
Require stack:
- /home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js
- /home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at WebpackModuleFileIterator.resolve [as requireResolve] (internal/modules/cjs/helpers.js:94:19)
    at WebpackModuleFileIterator.getActualFilename (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:951366)
    at WebpackModuleFileIterator.internalCallback (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:951069)
    at WebpackModuleFileIterator.iterateFiles (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:950743)
    at /home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:934035
    at WebpackChunkModuleIterator.iterateModules (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:944908)
    at PluginChunkReadHandler.processChunk (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:933986)
    at _loop_1 (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:947697)
    at WebpackCompilerHandler.iterateChunks (/home/runner/work/ghaction-package-latest-version/ghaction-package-latest-version/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:948562)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] prepare: `ncc build src/index.js -o dist --source-map --license licenses.txt`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] prepare script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2021-04-08T06_50_57_668Z-debug.log
Error: Process completed with exit code 1.

@guybedford
Copy link
Contributor

Can someone please post a minimal replication of this issue?

@nogic1008
Copy link

@guybedford
Reproduction is here. https://github.com/nogic1008/ncc-webpack-error
Maybe --license option causes this issue.

@huozhi
Copy link
Member

huozhi commented Apr 9, 2021

found that license-webpack-plugin uses require.resolve('webpack') source

but installed ncc package doesn't have webpack as dependency in node_modules.

@YardenPorat
Copy link

still occur in 0.28.2

@songkeys
Copy link
Contributor

It seems that this commit (xz64/license-webpack-plugin@cf5de13#diff-5a5c513f0d9f5557331f013846e996727746302e89b394c0b705c1e7affd65b1L32) changes require.resolve to a changeable one for testing which makes ncc not able to recognise it. We could make a PR on that repo to fix it I think.

@dimitar-hristov
Copy link

By following the error message I just installed webpack using npm install webpack and it worked. But looking at the comment above, I suspect this is not the solution we need.

@guybedford
Copy link
Contributor

@songkeys nice work tracking that down. Locking / reverting the version of the license plugin seems like a simple temporary patch fix as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants