How to Delete the node modules Folder on Windows

If you attempt to delete the node_modules folder on Windows, you may have trouble for a variety of reasons. In some cases, for example, the folder nesting within the directory creates folder names that are too long. You might also get the annoying Folder Access Denied message stating, “You’ll need to provide administrator permission to delete this folder” (shown below).

The solution I use is to install RimRaf globally with npm and then use it to delete the folder. RimRaf is an implementation of the UNIX/LINUX command rm -rf for Node, which removes directories and their contents recursively. First, enter this command to install RimRaf from npm:

 

Once it is installed, you can use the following command from within the project directory that contains the node_modules folder.

That’s it! It works and it’s easy to remember and execute.

Share on facebook
Share on twitter
Share on linkedin

Related Articles

Raaj

Senior Frontend Developer

Experienced React & React Native Developer Skilled in Building Scalable, High-Performance Frontend Applications

Marie Dime

My personal Favorites
Sponser

This is the heading

Explore my blogs
Home
Blog
Projects

Get In Touch

What type of Service are you interested in?
Where can i reach you?
What would you like to discuss?