title: Node npm windows file paths are too long to install packages
body: <p><strong>Situation</strong></p>
  
  <p>I want to use gulp and related front-end tool chains in Windows-hosted development environments. I'm hitting a wall trying to use gulp plug-ins like Browser-Sync, because the node_modules folder graph fans out making the windows file paths too long to copy the files.  I'd like a pragmatic approach for handling this problem right now on Windows, irrespective of what the Node community may or may not provide to improve npm usability on the Windows in the future.</p>
  
  <p><strong>2 Questions</strong></p>
  
  <ol>
  <li><p>Is there an npm workflow for Windows that just works the way it was intended? "run the command and the files install" (e.g. comparable to npm on OSX, npm on Linux, ruby gems or even nuget)  I don't want to fiddle with a bunch of manual file edits, symlinks, etc. every time I use npm on Windows.</p></li>
  <li><p>Is there a well-documented, stable Cygwin workflow for npm and node execution to workaround the Windows API file path limits?</p></li>
  </ol>
  
  <p>Gory details listed below...</p>
  
  <p><strong>General Problem</strong> </p>
  
  <ul>
  <li>Running npm install from a standard Windows command prompt fails on deeply nested node_modules hierarchies.</li>
  <li>Per Joyent's github repo thread, <a href="https://github.com/joyent/node/issues/6960#issuecomment-46704998" rel="noreferrer">this is an acknowledged issue</a> with no palatable workarounds for developers in Windows-centric environments. (<strong>Really?</strong>)</li>
  <li>NT Kernel supports file path lengths up to 32,767 characters. </li>
  <li>Windows API's MAXPATH is limited to 260 characters. </li>
  <li>Windows API handles file operations for all major Windows shells and whatnot including: Explorer, CMD, Powershell,MYSgit bash, etc. (<strong>MS really?  How long has NTFS been around?</strong>)</li>
  <li>Cygwin supports long file paths, but npm.cmd doesn't work out-of-box due to crlf formatting.  I tried the DOS2Unix transform on npm to get it working with Cygwin, but there seem to be other issues with this.</li>
  </ul>
  
  <p><strong>My Current Hack</strong></p>
  
  <ul>
  <li>Create an "n" folder as a staging area on the root of C:\, because
  this shortens my folder path. </li>
  <li>Run npm inside the "n" folder to install modules for whatever I need. </li>
  <li>Fire up Cygwin and use cp to copy the node_modules folder into a destination project. </li>
  <li>Rinse and repeat when dependencies change or when I need to spin up a new project.</li>
  </ul>
  
  <p><strong>Other Unpalatable Workarounds</strong></p>
  
  <p><strong>Symbolic Links</strong> can be used to shorten file paths, but these are kludgy hacks.  As the npm ecosystem grows, nested dependency chains will become too long and this workaround become unusable.</p>
  
  <p><strong>Adding ALL dependences to the root folder's package.json</strong> file was mentioned in one thread I came across. Although this approach will flatten the folder structure and prevent loading of duplicate modules, this workaround feels unnatural.  It also kills the usability, durability, and productivity of npm, because you have to fiddle with files and folders post-install either manually or with some hacky scripts. The approach is also vulnerable to the same fate that Symbolic Links approach may eventually suffer. </p>