DEV Community

RajeshKumarYadav.com
RajeshKumarYadav.com

Posted on • Updated on

Node.js : Updating NPM and packages

Since npm itself is a Node.js module, it can be updated using itself.
If OS is Windows must be running command prompt as Admin

npm install -g npm@latest
Enter fullscreen mode Exit fullscreen mode

If you want to check for updated versions you can do:

npm outdated
Enter fullscreen mode Exit fullscreen mode

In order to update a specific package:

npm update <package name>
Enter fullscreen mode Exit fullscreen mode

This will update the package to the latest version according to the restrictions in package.json

In case you also want to lock the updated version in package.json:

npm update <package name> --save
Enter fullscreen mode Exit fullscreen mode

Buy Me A Coffee

With all that being said, I highly recommend you keep learning!

Thank you for reading this article. Please feel free to connect with me on LinkedIn and Twitter.

Top comments (0)