Webpack 4使用报错:The CLI moved into a separate package: webpack-cli.
webpack升级到4.0.1,执行webpack命令报错:
>webpack -v
The CLI moved into a separate package: webpack-cli.
Please install 'webpack-cli' in addition to webpack itself to use the CLI.
-> When using npm: npm install webpack-cli -D
-> When using yarn: yarn add webpack-cli -D
按错误提示,webpack单独分离出了wepack-cli,需要我们安装wepack-cli。
全局安装:
npm i -g webpack-cli
全局安装webpack-cli后,使用webpack -v成功。
在项目本地安装webpack,webpack-cli:
npm install webpack webpack-cli -D