Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

node_modules directory structure has file names longer than 250 characters #4054

Closed
ghost opened this issue Oct 29, 2013 · 5 comments
Closed

Comments

@ghost
Copy link

ghost commented Oct 29, 2013

Hey guys/gals :) Great system, by the way! I'm having some trouble, however, as I'm unable to move my project on my disk because Windows is saying that over 100 files within the node_modules directory structure have file names longer than 250 characters. I've isolated it to files inside of grunt-contrib-imagemin and grunt-google-cdn. Since Windows has a file name size limit of 250, is there a way you could use a shallower directory structure for these? For some reason, the scripts that made the files were able to do so, but now nothing can deal with these files. I can't zip them or copy them. If I open one of the really long ones, Windows has consolidated all the node_modules parts of the path to NODE_M~1, but that doesn't seem to help when writing the files, such as copying, etc. Any help would be much appreciated!

@ghost
Copy link
Author

ghost commented Oct 29, 2013

Oh, if this helps, here's one of the long directory paths:

node_modules\grunt-google-cdn\node_modules\bower\node_modules\update-notifier\node_modules\request\node_modules\form-data\node_modules\combined-stream\test\integration\test-delayed-streams-and-buffers-and-strings.js

That's 216, plus if you prepend it with the path where the project is living, it pops past 250. There's over 100 files in these structures with this problem, as I said above :)

Cheers!

@domenic
Copy link
Contributor

domenic commented Oct 29, 2013

Nope, this is a Windows Explorer limitation, not something npm can control. npm (and node) use filesystem methods that do not have this limitation; if you are using other software (such as Windows Explorer) that does not support long file names, the bugs need to be fixed there, and not in npm.

@tjwebb
Copy link

tjwebb commented Jun 6, 2014

We were seeing this issue as well on Windows; specifically with Virtualbox shared folders. Would npm flatten help resolve this?

cc @lynnaloo

@abergs
Copy link

abergs commented Aug 7, 2014

To move the project, delete the node_modules first and then run npm install on the new location.

However, you will not be able to delete it from explorer. I built this small powershell script that does it for you. https://gist.github.com/abergs/e682cd1f98f5170e86a6

We use that script at work.

@othiym23
Copy link
Contributor

npm -g install rimraf
rimraf C:\path\to\node_modules

will take care of removing the paths.

@tjwebb npm dedupe will help with this somewhat, but to really address it will require a more comprehensive solution. I'm closing this issue in favor of #5641, of which it is a duplicate, and which also discusses some of the issues standing in the way of resolving the underlying issues. See also the discussion on #3697.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants