I moved my project to another computer, ran npm install. Project works fine except webpack-dev-server, it throws error
module.js:544
throw err;
^
Error: Cannot find module '../lib/polyfills'
at Function.Module._resolveFilename (module.js:542:15)
at Function.Module._load (module.js:472:25)
at Module.require (module.js:585:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/project/node_modules/.bin/webpack-dev-server:6:1)
at Module._compile (module.js:641:30)
at Object.Module._extensions..js (module.js:652:10)
at Module.load (module.js:560:32)
at tryModuleLoad (module.js:503:12)
at Function.Module._load (module.js:495:3)
What is it missing ?
The fix: rm -rf node_modules && npm install
Because..... who knows why /shrug
I had this exact issue and fixed it doing the following.
Running webpack-dev-server
gave the error you pasted.
I thought it may have been a configuration issue, so I tried node_modules/.bin/webpack-dev-server
to fix the configuration via the CLI.
Doing this, I was given the same error.
The file inside of .bin
existed but something was clearly wrong. I suspect it's because I seeded this project by copying from another one and perhaps references normally set as part of npm install
weren't set on the copy, so they were still pointing to the source of my copy.
Regardless, run npm install --save-dev webpack-dev-server
again and try. Fixed my issue both in running webpack-dev-server
and the CLI even though they were already installed. Perhaps just installed improperly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With