How to remove node_modules folder from the project on windows machine?
When I was setting-up a project with node.js the first time and I got this folder called “node_modules” in my project folder. The set-up was not correct and I decided to remove “node_modules” folder manually and due to its folder / directory nesting Windows can’t delete the folder as its name is too long. The node_modules directory on windows won’t let me delete that folder and I received a annoying message “Directory name is too long” to solve this, I followed the steps given below to remove node_modules folder:
- Install rimraf: npm install rimraf -g
- Go to C:\Users\username\AppData\Roaming\npm\node_modules and check if “rimraf” directory is there if “Yes” then follow the 3rd step
- Type rimraf node_modules in node.js command line. In some cases rimraf will do.