webpack4.0.1安装问题和webpack.config.js的配置变化

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

webpack4.0.1安装问题,提示:
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 -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


意思是CLI被移动到了一个专门的包 webpack-cli里了。
请安装webpack-cli 的除了webpack本身使用cli
当用npm时,使用npm install webpack-cli -D安装。
当用yarn时,使用yarn add webpack-cli -D安装。


解决办法:全局安装webpack-cli

npm install webpack-cli -g

 


就能提示出版本号了。

posted @ 2019-02-24 19:22  xtjatswc  阅读(141)  评论(0编辑  收藏  举报