Windows filepath too long when deleting node_modules
16 Sep 2014I'm currently forced to develop on Windows. And it hurts. I feel like a clockmaker forced to work with gloves and blindfolded. I keep hitting strange and weird Windows limitations that are real productivity killers.
The most recent was not being able to delete a folder because its filename was too long. Wait, what ? As soon as you start using npm
and download a bit of modules, you'll most certainly end up with a node_modules
folder that's too long for Windows to handle.
But npm
is clever, and it can circumvent this limitation. So, whenever you want to delete a node_modules
folder and Windows won't let you do it, use npm
. Update your package.json
to remove every element in dependencies
and devDependencies
and run npm prune
. This will empty your node_modules
folder.
You're welcome.
Want to add something ? Feel free to get in touch on Twitter : @pixelastic