NPM (Node Package Manager)
npm is the package manager for the Node JavaScript platform. Over time packages used in an application will become outdates and should be updated to newer versions.
Updating Node packages
Tested On
- Firebase Cloud Fucntions
- Angular Project
References
Steps
-
Navigate to the folder with the
package.jsonfile and thenode_modulesdirectory.Note: If there is a new minor or patch release and we type
npm update, the installed version is updated, and the package-lock.json file diligently filled with the new version. - To view outdated packages:
$ npm outdatedDemo:

- To update to a new major version all the packages, install the npm-check-updates package globally:
$ npm install -g npm-check-updatesDemo:

then run the updates:
$ ncu -uthis will upgrade all the version hints in the package.json file, to dependencies and devDependencies, so npm can install the new major version.
Demo:

-
Installing the updates.
If you just downloaded the project without the node_modules dependencies and you want to install the shiny new versions first, just run
npm install
If you already had a node modules folder and just want to update it, then run:
$ npm updateDemo:

Note: Running
npm updatein the demo is blank because nothing needed to be updated since we just ran npm install. - Test if your project runs. If your project does not run, try deleting the
node_modeulesdirectory and thepackage.lockthen recreating them with the following command (run the command in the directory where thepackage.jsonis located.)$ npm installDemo:

Note: If you have an error with a specific package, it may help to remove the package from node modules with npm uninstall <package name> then running npm install again.
Journal
- 2020.06.21 Created how to update node
- 2020.06.26 Updated file name to
NPMand updated description