webpack-dev-server Cannot find module 'webpack'
I had the same problem, but I resolved by installing additional webpack-cli
npm install --save-dev webpack-cli
npm install --save-dev webpack
is not enough.
You also have to install the following:
npm install --save-dev webpack-dev-server
And optionally, you can also install:
npm install --save-dev webpack-dev-middleware webpack-hot-middleware
Try the following:
Firstly, you need to install webpack-dev-server
npm install --save-dev webpack-dev-server
Then in your package.json, use this in your start script:
"start": "webpack serve --config webpack.config.js --open"
Note webpack.config.js
should be replaced with the file name of your webpack config file.
Now run npm start
Hope it works!