webpack-dev-server: *bug* Module not found: Error: Can't resolve 'loglevel' in webpack-dev-server/client

I think this https://github.com/webpack/webpack-dev-server/blob/master/package.json#L41 should be in dependencies not devDependencies. It’s causing the module not found error, after I do webpack-dev-server

I installed with npm install --save-dev https://github.com/webpack/webpack-dev-server.git

I needed to do this rather than npm install --save-dev webpack-dev-server because I’m trying to get around that Error: addMembership EHOSTUNREACH issue.

I’m using Windows 10 64bit and here’s a piece of my package.json file

"webpack": "^3.0.0",
"webpack-dev-server": "git+https://github.com/webpack/webpack-dev-server.git"

please let me know if I’m doing something wrong. I believe this is a bug.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 38
  • Comments: 18 (1 by maintainers)

Commits related to this issue

Most upvoted comments

I think this is caused since the loglevel package being used in client/index.js but is listed under devDependencies in the package.json instead of dependencies and hence is not installed I resolved it by simply running

npm i loglevel

Edit: (just realised this was mentioned in the issue, my bad)

But why? Is this a bug or…?

Now with the recent version of webpack-dev-server you must also install loglevel

If you have already globally installed webpack-dev-server. Use command npm install -g loglevel if you have already locally installed webpack-dev-server. Use command npm install --save-dev loglevel

I was having similar error Module not found: Error: Can't resolve 'loglevel' with webpack-dev-server and also solved it by npm -D loglevel

Strange, but after having same error i install loglevel under devDependencies and this also solved the problem…

@markelog I personally 99% sure it’s a bug and loglevel should be moved from devDependencies to dependencies. Pull request with solution is already submitted by @athomann (#1001)

Still happening in 3.10.1. Might be happening because I installed webpack-dev-server in a parent directory due to a mono repository architecture.

Fixed in webpack-dev-server@2.6.1.

@DavidNorena, I don’t see any critical innovations in webpack-dev-server@2.6.0 improving developer experience, so if you don’t need any of these updates, you can fallback to previous version until the bug is fixed or as you said it above, you can manually install loglevel mentioned in @sayanriju comment or if you are using yarn - yarn add -D loglevel