In npm all packages have their own dependencies so specifying a specific version sort of works. In Maven for example the dependency tree is flattened by the package manager so that at runtime there can only be a single version of libA. This is just how Java 8 and below works, you simply cannot import two versions of com.example.Foo at the same time. This will change in Java 9 with Jigsaw though. OSGi was a way to workaround this problem in <= Java 8. npm also has a "flattening" feature to save disk space but this is a completely different thing, an implementation detail that is never visible to the packages themselves.