Node requires you to install webpack to your project.
You have 2 options to solve the above:
-
Remove global webpack and install it locally
npm uninstall -g webpack npm install --save-dev html-webpack-plugin webpack webpack-dev-server
-
You can link the global webpack pkg to your project's node modules. The downside of this is that your project will be forced to use most updated webpack. This will create a problem only when some updates are not backwards compatible.
npm i webpack -g; npm link webpack --save-dev
You can omit the html-webpack-plugin depending on your requirement.
You can find more info here: https://github.com/webpack/webpack/issues/2131
我选择的是第二种