title: How to deploy Node.js application with deep node_modules structure on Windows?
body: <p>I've run into a curious issue - apparently some Node.js module have so <strong><em>deep</em> folder hierarchies</strong> that Windows copy command (or PowerShell's <code>Copy-Item</code> which is what we're actually using) hits the infamous "path too long" error when path is over 250 chars long.</p>
  
  <p>For example, this is a folder hierarchy that a single Node module can create:</p>
  
  <pre><code>node_modules\nodemailer\node_modules\simplesmtp\node_modules\
  xoauth2\node_modules\request\node_modules\form-data\node_modules\
  combined-stream\node_modules\delayed-stream\...
  </code></pre>
  
  <p>It seems insane but is a reality with Node modules.</p>
  
  <p>We need to use copy-paste during deployment (we're not using a "clever" target platform like Heroku where Git deployment would be an option) and this is a serious limitation on Windows.</p>
  
  <p><strong>Isn't there a npm command or something that would compact the <code>node_modules</code> folder or maybe include only what's actually necessary at runtime?</strong> (Node modules usually contain <code>test</code> folders etc. which we don't need to deploy.) Any other ideas how to work around it? Not using Windows is unfortunately not an option :)</p>