最近给学弟学妹安装webpack时出现一些奇怪的问题,多次尝试后终于找到解决方法,但是原因还有待研究。
1.报错信息:
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 "yarn" to install the CLI via "yarn add -D".
Which one do you like to install (webpack-cli/webpack-command):
猜想是重复安装的原因
解决方法:1.npm uninstall webpack删除本地的webpack
2.npm install webpack@3.10.0(版本号) --save-dev -g全局安装webpack。之后可以通过命令行查看是否安装成功