安装了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:

We will use "npm" to install the CLI via "npm install -D".
Which one do you like to install (webpack-cli/webpack-command):

阅读 33.2k
4 个回答

先全局安装webpack和webpack-cli
npm install webpack -g
npm install webpack-cli -g
再局部安装webpack和webpack-cli
npm install webpack --save-dev
npm install webpack-cli --save-dev
亲测有效~

sudo cnpm install webpack-cli -g

// linux 非root用户需要sudo 授权。

需要安装一个webpack-cli
npm webpack-cli -g
就可以了

或者 npm webpack-command -g (这个就没有测试了)

npx webpack 就可以了,4.x版本用的npx

推荐问题
宣传栏