Every npm project comes with node_modules folder after installation. It’s all nice and fancy while you’re working on the project, but what happens when you need to delete it?
Say you are moving repositories, renaming folders or just clearing up old stuff. If you are using Windows, chances are that you will get “path too long” or something along the lines.
Windows has 260 characters limit on path files and deleting so many nested folders is impossible with the “delete” function.
How to delete node_modules
Ironically, you need another npm module for that. Now, in order to make it work, you need to have it installed globally. Run the following command:
npm install rimraf -g
After doing this you will have access to the command anywhere on the system. To delete the npm folder just run:
See more on the package’s page.
Thanks to all this you can really feel like a Windows user 🙂 #nohate
Leave a Reply