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

Error: Cannot find module 'webpack-cli/bin/config-yargs' #1602

Closed
richburdon opened this issue May 31, 2020 · 9 comments · Fixed by webpack/webpack.js.org#4091
Closed

Error: Cannot find module 'webpack-cli/bin/config-yargs' #1602

richburdon opened this issue May 31, 2020 · 9 comments · Fixed by webpack/webpack.js.org#4091

Comments

@richburdon
Copy link

Describe the bug

Possible regression of: webpack/webpack-dev-server#2029

What is the current behavior?

The following error running webpack-dev-server:

The CLI moved into a separate package: webpack-cli
Please install 'webpack-cli' in addition to webpack itself to use the CLI
-> When using npm: npm i -D webpack-cli
-> When using yarn: yarn add -D webpack-cli
internal/modules/cjs/loader.js:960
  throw err;
  ^

Error: Cannot find module 'webpack-cli/bin/config-yargs'
Require stack:
- /Users/burdon/Projects/src/dxos/console/node_modules/webpack-dev-server/bin/webpack-dev-server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/Users/burdon/Projects/src/dxos/console/node_modules/webpack-dev-server/bin/webpack-dev-server.js:65:1)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/burdon/Projects/src/dxos/console/node_modules/webpack-dev-server/bin/webpack-dev-server.js'
  ]
}

To Reproduce

Steps to reproduce the behavior:

`yarn webpack-dev-server'

Expected behavior

Dev server should start

Please paste the results of webpack-cli info here, and mention other relevant information

  System:
    OS: macOS 10.15.5
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 1.71 GB / 32.00 GB
  Binaries:
    Node: 12.16.3 - /var/folders/g3/bdcdx0l516l_x6lh5pnsksxw0000gn/T/yarn--1590950071541-0.6189552325477377/node
    Yarn: 1.22.4 - /var/folders/g3/bdcdx0l516l_x6lh5pnsksxw0000gn/T/yarn--1590950071541-0.6189552325477377/yarn
    npm: 6.14.4 - ~/.nodenv/versions/12.16.3/bin/npm
  Browsers:
    Chrome: 83.0.4103.61
    Firefox: 76.0.1
    Safari: 13.1.1
  npmPackages:
    dotenv-webpack: ^1.8.0 => 1.8.0
    html-webpack-plugin: ^4.3.0 => 4.3.0
    webpack: ^4.41.2 => 4.43.0
    webpack-cli: ^3.3.11 => 3.3.11

With config:

    "webpack": "^4.41.2",
    "webpack-bundle-analyzer": "^3.6.0",
    "webpack-cli": "^3.3.10",
    "webpack-dev-server": "^3.11.0",
    "webpack-merge": "^4.2.2",
    "webpack-version-file-plugin": "^0.4.0",
@richburdon
Copy link
Author

This seems to be an issue with monorepos when webpack-cli is hoisted.

The workaround is to add the dependency to the monorepo root package.json but this shouldn't be necessary.

@alexander-akait
Copy link
Member

Yes it is a bug, not related to webpack-cli, bug on webpack-dev-server side

@hpachy
Copy link

hpachy commented Oct 23, 2020

Hello,

I would like to know is a solution is currently available... I started webpack yesterday to improve and have more control on my application. This bug make me puzzled about it's because in the webpack tutorial a lot of manipulation use webpack-dev-server.

Hopefully it's a good place to ask my question.

Regards

@alexander-akait
Copy link
Member

@hpachy Can you provide links?

@hpachy
Copy link

hpachy commented Oct 23, 2020

for example this one :

-https://webpack.js.org/guides/development/
-https://webpack.js.org/guides/build-performance/ (compile memory)
-https://webpack.js.org/guides/development-vagrant/
-https://webpack.js.org/guides/hot-module-replacement/ (webpack-dev-server --hotOnly)

for now I stoped here but I'm still following the tutorial, it's maybe my bad but I tried it and it's not working / not fixed so I just asking you if it s totaly fine or not ;)

regards

edited : 10/26/20
I'm still working on the tutorial and I found the same error just there:
-https://webpack.js.org/guides/production/

should be something like that I guess : webpack serve --config webpack.dev.js

If I find others link I'm gonna put there here

@alexander-akait
Copy link
Member

Big thanks, WIP on docs

@alexander-akait
Copy link
Member

@hpachy PR was sent

@hpachy
Copy link

hpachy commented Oct 23, 2020

your welcome it's been a pleasure!

@rajivbandaru97
Copy link

npm run build

[email protected] build G:\shareip\vuedj
cross-env NODE_ENV=production webpack --progress --hide-modules

internal/modules/cjs/loader.js:883
throw err;
^

Error: Cannot find module 'v8-compile-cache'
Require stack:

  • C:\Users\lenovo\AppData\Roaming\npm\node_modules\webpack-cli\bin\cli.js
  • G:\shareip\vuedj\node_modules\webpack\bin\webpack.js
    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. (C:\Users\lenovo\AppData\Roaming\npm\node_modules\webpack-cli\bin\cli.js:5:1)
    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) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    'C:\Users\lenovo\AppData\Roaming\npm\node_modules\webpack-cli\bin\cli.js',
    'G:\shareip\vuedj\node_modules\webpack\bin\webpack.js'
    ]
    }
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! [email protected] build: cross-env NODE_ENV=production webpack --progress --hide-modules
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the [email protected] build 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! C:\Users\lenovo\AppData\Roaming\npm-cache_logs\2020-11-22T07_22_05_093Z-debug.log

I ran the command npm-doctor.
It asked me to update my npm and node. I did that as mentioned. I even changed my environment variable path to c:/program files/nodejs, still getting the same error. Is the error related with the webpack-cli? It would be really helpful if I get some insight into this. Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants