The CLI moved into a separate package: webpack-cli The CLI moved into a separate package: webpack-cli php php

The CLI moved into a separate package: webpack-cli


I went through the same example and faced the same issue. So following the above answers I first ran this command -

npm install -g webpack-cli --save-dev

Nothing happened and was still facing the same issue.

Then I ran this command -

npm install webpack-cli --save-dev

The issue was solved but I was getting another error.

enter image description here

Turns out in the new Webpack version they have changed the module attributes also. So you need to make change in the webpack.config.js file also.

module: {        rules: [          {             test: /\.jsx?$/,             exclude: /node_modules/,             loader: 'babel-loader',             query: {                presets: ['es2015', 'react']             }          }        ]   }