Home > Software design >  npm not installed latest version of package even after using caret(^)
npm not installed latest version of package even after using caret(^)

Time:04-07

I have added a package(X) as follows in package.json file

package(X): "^5.0.0"

now the latest version of package(X) is 5.0.1. According to my understanding this should install 5.0.1 but it installs version 5.0.0 itself.

Now I have multiple angular projects which are using package(X) and each of them have the same setup. What surprises me is that it works absolutely fine i.e installs version 5.0.1 in some projects and does not in some projects

Here is the info about package(x)

npm library info

CodePudding user response:

It does depend on other packages' dependencies. If there is a package that requires X to be exactly 5.0.0, then it will install 5.0.0 as it will satisfy ^5.0.0. If there isn't one, then it will install whichever latest that will satisfy ^5.0.0 which is 5.0.1 in this case.

  • Related