Baterka
Baterka

Reputation: 3694

How to update npm package's dependency?

I am trying to update dependency of package I am installing trough npm.

When I install appium package, I get version 1.22.0 which is correct. But this package also have dependencies that getting regular updates on github and are propagated on npmjs.

But when I install main package, dependency is not latest.

For example, I need to update appium-espresso-driver dependency of appium to 1.50.1, but everytime I install appium, dependency is only 1.45.3, even when appium have ^1.0.0 in package.json

How to update this? Do I need to wait for appium package to be bumped?

Upvotes: 1

Views: 7723

Answers (1)

Wesler
Wesler

Reputation: 51

If you want to update all the packages to the latest version and you are using npm, you can see this documentation npm-update, but the short answer is:

npm update

This helps to update every package of the project, you can do it in the root folder, and update everything in the package.json.

If you want to update everything to a latest version, you can use npm-check-updates, this will check the latest version of the packages that you have installed on package.json, I will show you the easy steps to install this but you can go through the documentation of the module in here:

  • npm install -g npm-check-updates

This will install you the package, then after that you need to run in in the root folder:

  • ncu -u

So after that command it will update all the packages in the package.json but not install them, so after running ncu -u you need to run again:

  • npm install

To install the new versions of the package.

Upvotes: 3

Related Questions