0

When using node.js with Windows-based projects, it's recommended that you use an npm package such as flatten-packages to prevent directory depth from getting out of control. This is because Windows has a MAX_PATH limitation: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath

https://github.com/Microsoft/nodejstools/issues/69

Are there potential problems of node_modules folder nesting growing out of control in OSX? This question is more about contrasting development between Windows and OSX in Node.js

Caleb Faruki
  • 2,577
  • 3
  • 30
  • 54

1 Answers1

1

NPM v3 uses a much flatter directory structure: https://docs.npmjs.com/how-npm-works/npm3

While npm2 installs all dependencies in a nested way, npm3 tries to mitigate the deep trees and redundancy that such nesting causes. npm3 attempts this by installing some secondary dependencies (dependencies of dependencies) in a flat way, in the same directory as the primary dependency that requires it.

That's probably the simplest solution to your problem.

The actual maximum path length on OSX seems to be 1016 characters, so about 4 times longer than on Windows.

Community
  • 1
  • 1
Steve Bennett
  • 114,604
  • 39
  • 168
  • 219
  • My question is more about the limitations of npm2 in relation to OSX. I did know about this, though. I'm not running into this problem, at the moment. It's more of a hypothetical. – Caleb Faruki Jan 11 '16 at 23:15