a quick guide on how to delete the node module when you face access/ permission error

node modules

How to Delete the node modules Folder on Windows

a quick guide on how to delete the node module when you face access/ permission error

access/permission error

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”.

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:

install rimraf

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

delete node modules

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

Leave a Reply