[Solved] How to delete or remove ‘node modules’ folder including nested folders in deep from the project

Problem

Trying to remove the node_modules directory created by npm install:

The source file name(s) are larger than is supported by the file system. Try moving to a location that has a shorter path name, or try renaming to shorter name(s) before attempting this operation

I also tried using windows shortcut key shift + delete and rimraf NPM package, still having the same issue.

Solution

Using ‘Git Bash’ to remove the folder is the simplest way to remove all folders including subfolders in the ‘node modules’. It will take a while to delete everything, but it works without any installation.

Open the project’s root folder then right-click and choose ‘Git Bash Here’, and use this command to remove the node modules folder.

rm -r node_modules
remove node_modules directory created by npm install
remove node_modules directory created by npm install

If this option is not visible to you then probably you have not installed the git version control use the below link to download it and start and follow the same by using it and explore more on this.

https://git-scm.com/downloads

Default image
Shivaraju M
Over 3+ years experience in IT industry, good knowledge in . Net-based Web applications, windows applications, web services, and SPAs. I have played multiple roles related to technical delivery in multiple domains while working on over 10+ technologies. I am currently focused on continuous improvement and agile project management.

Leave a Reply