windowsnpmdirectoryyeoman

removing node_modules folder


The problem:

I've created a yeoman project by mistake on my windows box. Via explorer when I try to delete it I get an error saying that the path is too long.

Source too long error

Several Solutions:

But is there a script based solution?


Solution

  • You can write powershell to this effect relying on npm

    PS C:\code\yeoman-foo> ls node_modules | foreach {
    >> echo $("Deleting module..." + $_.Name)
    >> & npm rm $_.Name
    >> }
    >>
    

    After the above command completes you can remove the folder by the traditional ways...

    Go to the parent folder containing the project folder, select it, and SHIFT + DEL