Installed directory structure is too long. Causes problems on Windows and can't be used with TFS source control #85

Closed
deadlydog opened this Issue Nov 4, 2013 · 8 comments

Projects

None yet

6 participants

@deadlydog

The directory structure of grunt-bower-task when installed is too long. Using "npm install", the path of the longest file, excluding the project directory that it would reside in, is 230 characters:

"\node_modules\grunt-bower-task\node_modules\bower\node_modules\update-notifier\node_modules\request\node_modules\form-data\node_modules\combined-stream\node_modules\delayed-stream\test\integration\test-delayed-stream-auto-pause.js"

Windows has a stupid restriction that affects TFS where a path can have a max length of 260 characters (http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx), so this only leaves 30 characters for the path that the project will reside in.

Because we work on enterprise applications, we are required to have ALL dependencies checked into source control; we can't be installing them from the internet at build time on the build server. Effectively this means that we can't use grunt-bower-task in production until this issue is fixed.

Since the 260 character limit is a Windows (FAT and NTFS file system) problem, I assume it affects other source control repositories on Windows, but I haven't confirmed that. I expect that many other people using Windows have this same problem.

If you want to see how long all of the file paths are, you can use the Path Length Checker tool at https://pathlengthchecker.codeplex.com/releases/view/82070.

I notice that there are many "node_modules" directories; perhaps just shortening those to "n_m" is an easy solution; it would shave 54 characters off of your paths.

@deadlydog

Just an FYI that I've opened the following Stack Overflow question to find a work around until this can get fixed. http://stackoverflow.com/questions/19795171/how-to-make-grunt-deploy-use-global-npm-modules-instead-of-local-ones/
Thanks.

@jasonkarns

The node_modules directory is managed (and named) by npm, not grunt or this task. It can't be changed. The (seemingly) recursive nesting of node_modules directories is necessary to provide localized versions of duplicate modules.

@deadlydog

Hey @jasonkarns thanks for clarifying that this is not a grunt problem and for posting a work around on the stack overflow link. For now we've got it working using symbolic links, but if I try your workaround out I'll be sure to post my results on the StackOverflow link. Thanks again.

@deadlydog deadlydog closed this Dec 31, 2013
@jasonkarns

Glad you got something working!

@zetlen
zetlen commented Oct 12, 2014

I know you found a workaround, but since you've had this issue before I wanted you to know that I've created a tool called fenestrate which you can use to programmatically flatten the directory structure of your modules after installation. You can install it as a global npm postinstall hook.

@Sabbir786

anyone used “Long Path Tool”
This tool is great
Thanks

@Damienbarifon

Try to long path tool. It is very helpful.

@Streder
Streder commented Feb 12, 2016

The Long Path Tool is not free however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment