problem Description: I want to check the version of Webpack, so I entered the command Webpack-v, as shown in the following:
Note: We are prompted to install WEBPACK-CLI because Webpack4, Webpack has migrated webpack command-line related content to WEBPACK-CLI package
Workaround:
sudo npm uninstall webpack-g (uninstall Webpack)
sudo npm install webpack-g (Global installation Webpack)
sudo npm install webpack-cli-g (installed here webpack-cli, it must be noted that the Apple Computer needs to add sudo, otherwise it will always error, the hint can not find webpack-cli, such as)
Note: Why does installing WEBPACK-CLI here require sudo in front of the command line?
Because in the Mac under the dependency package to write to the system important folder, because the root permission is not obtained first, so that the write failed, the installation failed.
attached: Why should I add sudo to the Mac installation plugin?
https://www.zhihu.com/question/31723552
NPM installation Webpack failed (both Mac and window may encounter this situation, the following issues mainly in the case of Mac)