Webpack-dev-server: Can't resolve 'sockjs-client' in webpack-dev-server 2.6.0

Created on 23 Jul 2017  路  13Comments  路  Source: webpack/webpack-dev-server

ERROR in (webpack)-dev-server/client/socket.js
Module not found: Error: Can't resolve 'sockjs-client' in '.../node_modules/webpack-dev-server/client'
@ (webpack)-dev-server/client/socket.js 1:13-37
@ (webpack)-dev-server/client?http://0.0.0.0:8888
@ multi (webpack)-dev-server/client?http://0.0.0.0:8888 ./src/polyfills.browser.ts

Most helpful comment

Deleting "node_modules" and "npm install" doesn't work for me. But clearing cache before "npm install" works. Here are the steps

  1. Delete node_modules
  2. npm cache clear --force
  3. npm install

I tried several times with only step 1 and 3 with no luck until I tried to clear cache then install. Somehow, npm messed up my cache too :(

All 13 comments

Does this also happen in the previous version?

Closed upgrade to 2.6.1

This happens to me in 2.7.1 (though it worked in 2.6.1)

Running:
[email protected]
[email protected]
[email protected]

It happened to me as well when i upgraded from 2.6.1 to 2.7.1.
You should try to delete the node_modules folder and run npm install again. It solved the problem for me.

This worked, thanks!

It worked for me as well, but I'm curious why does deleting node_modules sometimes help? Where's the bug hiding?

Deleting "node_modules" and "npm install" doesn't work for me. But clearing cache before "npm install" works. Here are the steps

  1. Delete node_modules
  2. npm cache clear --force
  3. npm install

I tried several times with only step 1 and 3 with no luck until I tried to clear cache then install. Somehow, npm messed up my cache too :(

Same v2.8.2,
delete node_modules
and npm i

Quick note for those on node v8.x: I also had to delete my package-lock.json file (in addition to node_modules) before running npm install

Added "sockjs-client": "^1.1.4",

It has the dist folder and js.

@aykutyararbas your suggestion did the trick for me.

@charliebrink Wonderful!

I had to chmod 777 the file in question :(

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gimmi picture gimmi  路  3Comments

mischkl picture mischkl  路  3Comments

StephanBijzitter picture StephanBijzitter  路  3Comments

mrdulin picture mrdulin  路  3Comments

tulika21-zz picture tulika21-zz  路  3Comments