webpack--Installation Error and solution

Source: Internet
Author: User

① First Delete

Delete Global Webpack-cli

webpack4.x official documentation is to install the CLI so if you need to uninstall the CLI in 4.+

npm uninstall -g webpack-cli# 注释给我这种小白提供参考# 卸载 uninstall  可以简写成 un  # 全局 -g 的完整写法是 --global# 现在问题来了这样真的卸载了webpack-cli吗?# 答案是没有。到现在为止我还没有发现那个webpack-cli是全局安装的,至少官方文档没看到。# 那就看下面怎么删除局部webpack-cli
Delete local (local) WEBPACK-CLI
npm uninstall webpack-cli# 仔细看你会发现去掉全局参数 -g# 这时候你的命令行会快速滚动一些删除信息。# webpack-cli删除成功
Delete Global Webpack
npm uninstall -g webpack# 这个注释还是给小白看的# 为什么要局部全局删除webpack# 因为你可能在安装webpack时不确定自己是全局安装# 还是本地安装,所以建议先执行全局删除命令# 然后在执行下面的本地删除命令
Delete local Webpack
npm un webpack# 这时候小白的webpack是删除完成了# 还没完看下面怎么说
Check for webpack residual files 
ls# 用ls命令查看一下是否有这几个文件# node_modules# package-lock.json# package.json# 有是最好的,如果没有那你可能还没找到自己本地安装webpack的准确位置# 有时候我也找不到了# 现在说有的事rm -rf node_modules package-lock.json package.json# 上面这行命令是删除这些文件的意思# 同学你的webpack 彻底删除干净了# 但是小白一定要好好去了解一下 rm 和 rm -rf 的区别,在这里我不科普怕说错。

②再安装
管理员模式下运行 cmd 输入 cnpm i webpack -g

这时候我们查看下webpack是否安装成功了,输入webpack -v

Tip We're going to webpack-cli, let's do a global installation.

NPM I Webpack-cli-g

Re-enter WEBPACK-V

This is my version number.

 

webpack--Installation Error and solution

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.