Rohit Jindal Rohit Jindal -5 years ago 320
Node.js Question

Windows Error : Source Path Too Long

Explanation :
There are about 15 subfolders in the

directory.When going to perform any operation(deleted, moved or renamed) it popup below message.

Error message:

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

Screenshot :
enter image description here

sub folder inside


Tried so far:

I also tried to delete the folder(node_modules) using command prompt using command
rmdir <dirname> /S
but did not work as well.

enter image description here

There is a way to do this is that go into subfolder after subfolder, renaming each folder to something short like 'b'. Eventually the path is short enough to allow deletion. This will waste quite a bit of time.

Is there any efficient way to delete this
Any immediate help will be highly appreciable. Thanks

Answer Source

Newest versions of npm fix this issue flattening the path:


D:\vms\fe> robocopy d:\path\to\temp\dir node_modules /purge

to remove the nested dirs.


As pointed by Rohit Jindal, another option is use rimraf util (which basically calls rm -rf):

> npm install -g rimraf
> rimraf node_modules
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download