使用webpack时提示缺少CLI,如当使用webpack -v查询版本号时,显示如下错误
One CLI for webpack must be installed. These are recommended choices, delivered as separate packages:
- webpack-cli (https://github.com/webpack/webpack-cli)
The original webpack full-featured CLI.
- webpack-command (https://github.com/webpack-contrib/webpack-command)
A lightweight, opinionated webpack CLI.
We will use "npm" to install the CLI via "npm install -D".
Which one do you like to install (webpack-cli/webpack-command):
One CLI needs to be installed alongside webpack to use the CLI.
解决:
npm install webpack-cli -g