xxxxxxxxxx
Use npm|yarn outdated to see which modules have newer versions
Use npm update|yarn upgrade (without a package name) to update all modules
Include --save-dev|--dev if you want to save the newer version numbers to your package.json. (NOTE: as of npm v5.0 this is only necessary for devDependencies).
Use npm install package@major-version to update to major version
xxxxxxxxxx
npm install -g npm@latest
#may require the use of sudo depending on your distro
sudo npm install -g npm@latest
xxxxxxxxxx
//Updating local packages
cd /path/to/project
npm update
//Updating globally-installed packages
npm install npm@latest -g
npm update -g
//Updating a single global package
npm update -g <package_name>
//Determining which global packages need updating
npm outdated -g --depth=0