1. 程式人生 > >安裝了webpack和webpack-cli,但是執行webpack命令報錯

安裝了webpack和webpack-cli,但是執行webpack命令報錯

安裝的webpack版本是4.9.1,webpack-cli版本號是2.1.4。執行webpack命令提示:
One CLI for webpack must be installed. These are recommended choices, delivered as separate packages:

webpack-cli (https://github.com/webpack/we
The original webpack full-featured CLI.
webpack-command (https://github.com/webpack-co
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):

解決:
需要安裝一個webpack-cli
npm install webpack-cli -g
就可以了

或者 npm install webpack-command -g (這個就沒有測試了)