0

When you install a package A that requires a dependency C of version 1.0.0 and then install package B that requires a dependency C of version 2.0.0

NPM v(3-6): replaces installed package C from version 1.0.0 to 2.0.0 and just shows a warning that a dependency needs to be installed.

NPM v(>=7) throws error that there's conflicting dependencies.

Of course, now updating package A to a version that supports a version of C that is also supported by package B can solve the issue. But what if package A was not developed after that and it supports only 1.0.0 of Package C. What if I want to have multiple versions of the same package in my node_module. I am just curious why npm doesn't allow you to have multiple versions of the same package.

  • Package A is free to return anything from any functions it provides, including objects supplied to it by package C. Package B is free to accept anything into any functions it provides, including objects supplied by package C. And all of course vice versa. There's no guarantee that two different versions of package C will be able to mutually interoperate with objects created by different versions. – Damien_The_Unbeliever Aug 31 '23 at 13:38

0 Answers0