How to delete node_modules and reinstall

How to delete node_modules and reinstall

When we are developing a project, there will be a problem that the version of the node package installed each time is inconsistent with the version required by the project. Therefore, you need to delete the node package and reinstall it. Many friends just delete it manually, but do not delete the package cache, so an error will still be reported when starting the project~

The next article will simply and directly tell you the detailed operation steps.

For Windows

Step 1: Install node_modules in the directory where the project needs to be installed

insert image description here

Step 2: Install the rimraf tool first

npm install -g rimraf

Step 3: Delete the node_modules package and package-lock.json file

rimraf node_modules
rimraf package-lock.json

Note: Both node_modules and package-lock.json need to be deleted. Deleting only node_modules will not work.

Step 4: Clear the cache

npm cache clear --force

Step 5: Reinstall dependency packages

The package-lock.json file will be automatically generated after the installation is complete

npm config set registry [https://registry.npm.taobao.org]

npm install

Step 6: Restart the project

This is the end of this article about how to delete node_modules and reinstall them. For more information about deleting node_modules and reinstalling them, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed explanation of how to modify files in node_modules
  • Detailed explanation of modification and use of third-party modules in node_modules in Vue
  • The difference between modules.exports and exports in node

<<:  Summary of MySQL 8.0 memory-related parameters

>>:  Ubuntu 20.04 turns on hidden recording noise reduction function (recommended)

Recommend

How to make JavaScript sleep or wait

Table of contents Overview Checking setTimeout() ...

Chinese website user experience rankings

<br />User experience is increasingly valued...

Example of disabling browser cache configuration in Vue project

When releasing a project, you will often encounte...

Various problems encountered in sending emails on Alibaba Cloud Centos6.X

Preface: I have newly installed an Alibaba cloud ...

An article teaches you to write clean JavaScript code

Table of contents 1. Variables Use meaningful nam...

Things to note when designing web pages for small-screen mobile devices

The reason is that this type of web page originate...

React ref usage examples

Table of contents What is ref How to use ref Plac...

Analysis of the principle of centering elements with CSS

It is a very common requirement to set the horizo...

WeChat applet implements calculator function

This article shares the specific code for the WeC...

Write a simple calculator using JavaScript

The effect is as follows:Reference Program: <!...

W3C Tutorial (6): W3C CSS Activities

A style sheet describes how a document should be ...

JavaScript implements circular carousel

This article shares the specific code of JavaScri...

CSS uses calc() to obtain the current visible screen height

First, let's take a look at the relative leng...