How to remove node_modules folder

16th April 2015

Reading Time:

Since I started using Vagrant and Grunt, my workflow has really improved. But due to a recent hiccup when installing Grunt to an existing (and old) project, I had to remove it and try again. Shouldn’t be a problem , right? That’s what I thought, until I tried to remove the node_modules folder.

As you might have seen, node_modules has an… interesting folder structure. As Windows 8 (and possibly 7) has a limit on the length of filepaths, the folder may not fit into the Recycle Bin and is difficult to delete manually. Luckily, there is a way.

First, install RimRaf:

npm install rimraf -g

Then remove node_modules folder using RimRaf:

rimraf node_modules

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *

About the author

Rik Kendell is a developer, designer and writer in Leeds, UK, specialising in responsive WordPress websites. With over 10 years experience in the industry, Rik has worked on award-winning teams at agencies, in-house and as a freelancer. Rik has worked with clients ranging from the NHS, Sky and Skipton Building Society to McDonalds, Lamb’s Navy Rum and Crabbie’s Ginger Beer.

Outside of work Rik is also a keen writer, an amateur woodworker, gamer and foodie. His blog posts, reviews and Tweets have been published by the BBC, the Evening Standard, the Guardian and the Independent. He has written guest posts for a number of agencies and industry websites.