I’m coming up on about a year of full-time NodeJS work, and it’s only now that I’m starting to understand the true nature of NPM’s dependency management.
When I’ve used other systems, (primarily composer), “management” of those dependencies meant your package manager will yell as you if there’s a conflicting package.
You want to install version 3 of
foo/bar
? Well too bad, one of your dependencies can only deal with version 2 offoo/bar
— sort it out.
NPM works a little differently. Instead of a project’s packages being one big soup, each of your dependencies will have its own node_modules
folder. This means, in our scenario above, if you want version 3 of foo/bar
you can have it. That other package will get its own version of foo/bar
.
The article I linked above from helpful internet stranger Alexis King goes into more details about the system, including NPM’s more traditional peerDependencies
.
I’m still not 100% on some of the edge cases, but at least now I understand why package conflicts have seemed like less of a thing in the past year.