Webpack-dev-server: Error: Cannot find module 'webpack/bin/config-optimist'

Created on 15 Aug 2018  路  2Comments  路  Source: webpack/webpack-dev-server


Bug report




What is the current behavior?
I try to start dev server, but I get this error:

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

Error: Cannot find module 'webpack/bin/config-optimist'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
    at Function.Module._load (internal/modules/cjs/loader.js:520:25)
    at Module.require (internal/modules/cjs/loader.js:650:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/webpack-dev-server/bin/webpack-dev-server.js:60:1)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)

If the current behavior is a bug, please provide the steps to reproduce.
I run the dev server from the command line using my config:
webpack-dev-server --config webpack.config.development.js

I just upgraded from webpack-dev-server v2 -> v3 and webpack v3 -> v4. I didn't have this problem with v2+v3.

Looks like there was a similar issue here:
https://github.com/mzgoddard/jest-webpack/issues/27

I have tried deleting my node_modules folder and rerunning npm install , which did not fix the issue.






What is the expected behavior?
It should be able to find the config-optimist file and start the server.


Other relevant information:
my package.json

 "webpack": "^4.8.3",
 "webpack-cli": "^2.1.3",
 "webpack-dev-server": "^3.1.4",

Node.js version: 10.8.0
Operating System:
OSX 10.13.4
Additional tools:
npm v 6.2.0

Thanks for any help on this! I'm definitely stuck on this one.

Most helpful comment

Oh!

I forgot to install(upgrade) webpack-cli and webpack-dev-server globally! Sorry to create noise here.

All 2 comments

Doing my own homework. Looks like config optimist used to be in that location:
https://github.com/webpack/webpack/tree/c0afdf9c6abc1dd70707c594e473802a566f7b6e/bin

I'm wondering what would be referencing the old file...

Oh!

I forgot to install(upgrade) webpack-cli and webpack-dev-server globally! Sorry to create noise here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

antoinerousseau picture antoinerousseau  路  3Comments

gimmi picture gimmi  路  3Comments

Jack-Works picture Jack-Works  路  3Comments

Ky6uk picture Ky6uk  路  3Comments

StephanBijzitter picture StephanBijzitter  路  3Comments