Skip to content

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

Closed
kenbkop opened this Issue Oct 29, 2013 · 5 comments

5 participants

@kenbkop
kenbkop 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!

@kenbkop
kenbkop 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
npm member
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
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
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
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.

@othiym23 othiym23 closed this Sep 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.