Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
20 lines (13 sloc) 1.25 KB
layout title permalink path
post
Path Name Too Long Windows
/path-name-too-long-windows/
2017-01-01-path-name-too-long-windows.md

The file name you specified is not valid or too long. Solution

Thanks to npm and the deeply nested node_modules directory, Windows users who are developing JavaScript applications will be faced with the dreaded The file name you specified is not valid or too long. error. Don't worry though, there's a really simple fix. Since npm and the node_modules directory is to blame, one can assume that npm is already installed, so let's use an npm package to resolve this issue once and for all.

Use npm to install the rimraf package. Rimraf is a handy tool that mimics the Unix command rm with the parameter rf or rm -rf which is used to remove all files in a directory. Make sure you install rimraf globally with -g.

npm install -g rimraf

Now you can simply target the stubron project or directory that's causing the The file name you specified is not valid or too long error and wipe it away.

rimraf <your directory>

Use rimraf with care, as it is very unforgiving. Don't point rimraf at anything you don't wish to completely elimante from your disk.