I\'ve run into a curious issue - apparently some Node.js module have so deep folder hierarchies that Windows copy command (or PowerShell\'s C
I found one solution from Microsoft Node.js Guidelines.
> npm install -g rimraf
delete files that exceed max_path
> npm dedupe
moves duplicate packages to top-level> npm install -g flatten-packages
moves all packages to top-level, but can cause versioning issuesnpm@3
which attempts to the make the node_modules
folder heirarchy maximally flat.
> npm install –g npm-windows-upgrade
I don't think there's any great solution given your constraints, but here are some things that may help.
npm dedupe
to optimize your directory hierarchy which may shorten some pathsnpm install --production
to install without the development toolsnode_modules
directory under your_project/node_modules/pkg_with_deep_deps
that will allow them to have short enough paths but still work. So this would be your_project/node_modules/pkg_with_deep_deps/node_modules
.
require
should be able to find those properly at run time. You'll just need to clearly document what you have manually changed, why you have done it, and keep your own true dependencies accurately represented in package.json
Here is a github issue discussion that elaborates on this problem in detail.