it:ad:npm:howto:deal_with_long_filenames

IT:AD:npm:HowTo:Deal With Long Filenames

Summary

Npm packages download dependency packages, which in turn download dependency packages…and sooner or later you end up with deeply nested directories.

And then you try to delete them…and you get errors all over the place similar to the following:

node_modules\gulp-watch\node_modules\gulp-util\node_modules\dateformat\node_modules\meow\node_modules\read-pkg-up\node_modules\read-pkg\node_modules\load-json-file\node_modules\parse-json\node_modules\error-ex\node_modules\is-arrayish\.istanbul.yml - The file name is too long.

The issue is that Windows has a max of 260 char for filenames. And they'll never change it. So you are going to have to work around it.

Know that 7Zip can delete long file names…but although that's really useful to know, it won't help you much with npm issues.

It's been mentioned that you can map directories to shorten the directory:

subst x: \path\to\long\folder
True…but it's not going to fix everything, and what a pain to have to do that…

Turns out that if nothing is going to fix it – every – there are only two things you can do.

  • /home/skysigal/public_html/data/pages/it/ad/npm/howto/deal_with_long_filenames.txt
  • Last modified: 2023/11/04 23:00
  • by 127.0.0.1