Earlier quoted context omitted.
That's a feature, not a bug. It lets A rely on version 0.9 of X while B relies on version 0.8.
Unless you create file paths that are so long that they break the default tools of the OS. That’s the point where you went too far.
1) Windows' limit of 260 characters per path name is incredibly small for a modern OS and that was true many years ago as well.
2) Npm approach relied on well behaved OSes and file systems allowing long path names. It's not future proof because you don't know on which OS and file system you'll need to run, maybe some limited embedded device.
Ruby's rvm solved that problem with a single directory level and a gem@version naming scheme.