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 update Ubuntu 20.04 LTS on Windows 10

April 23, 2020, Today, Ubuntu 20.04 on Windows al...

MySQL GROUP_CONCAT limitation solution

effect: The GROUP_CONCAT function can concatenate...

How to prevent users from copying web page content using pure CSS

Preface When I was typing my own personal blog, I...

Teach you how to use webpack to package and compile TypeScript code

TypeScript Bundling webpack integration Usually, ...

Specific use of MySQL internal temporary tables

Table of contents UNION Table initialization Exec...

Docker automated build Automated Build implementation process diagram

Automated build means using Docker Hub to connect...

Classification of web page color properties

Classification of color properties Any color can ...

HTML table tag tutorial (46): table footer tag

The <tfoot> tag is used to define the style...

Introduction to container of() function in Linux kernel programming

Preface In Linux kernel programming, you will oft...

Solve the problem of docker container exiting immediately after starting

Recently I was looking at how Docker allows conta...

JavaScript form validation example

HTML forms are commonly used to collect user info...

How to use shell to perform batch operations on multiple servers

Table of contents SSH protocol SSH Connection pro...

MySQL 8.0.16 winx64 installation and configuration method graphic tutorial

I just started learning about databases recently....

vue cli3 implements the steps of packaging by environment

The vue project built with cli3 is known as a zer...

How to use Webstorm and Chrome to debug Vue projects

Table of contents Preface 1. Create a new Vue pro...