NPM installation Webpack failed (both Mac and window may encounter this situation, the following issues mainly in the case of Mac)

Source: Internet
Author: User

  

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.