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/bin/config-optimist' #1459

Closed
livemixlove opened this issue Aug 15, 2018 · 5 comments
Closed

Error: Cannot find module 'webpack/bin/config-optimist' #1459

livemixlove opened this issue Aug 15, 2018 · 5 comments

Comments

@livemixlove
Copy link

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:
mzgoddard/jest-webpack#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.

@livemixlove
Copy link
Author

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...

@livemixlove
Copy link
Author

Oh!

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

@yangshuo2000
Copy link

Oh!

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

After I update to the latest version, I still can’t package it ,

webpack 5.45.1
webpack-cli 4.7.2
webpack-dev-server 1.16.5

How can i solve it, thanks

@alexander-akait
Copy link
Member

change webpack-dev-server on webpack serve in package.json

@egeddes
Copy link

egeddes commented Aug 4, 2021

change webpack-dev-server on webpack serve in package.json

@alexander-akait... What does that mean? What should we change, and where within package.json?
(Thank you for your help.)

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

No branches or pull requests

4 participants