I've run into a curious issue - apparently some Node.js module have so deep folder hierarchies that Windows copy command (or PowerShell's Copy-Item
which is what we're actually using) hits the infamous "path too long" error when path is over 250 chars long.
For example, this is a folder hierarchy that a single Node module can create:
node_modules\nodemailer\node_modules\simplesmtp\node_modules\
xoauth2\node_modules\request\node_modules\form-data\node_modules\
combined-stream\node_modules\delayed-stream\...
It seems insane but is a reality with Node modules.
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.
Isn't there a npm command or something that would compact the node_modules
folder or maybe include only what's actually necessary at runtime? (Node modules usually contain test
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 :)