npm install upgrade code example

Example 1: update npm

// update npm//
npm install -g npm@latest

Example 2: update npm

npm install -g npm@latest

Example 3: update node.js dependencies

npm install -g npm-check-updates
ncu -u
npm update
npm install

Example 4: update npm

// update npm to latest version //
npm install -g npm@latest

Example 5: update npm

npm install -g npm@latest 
// for global install

Example 6: update npm

// update node package manager
npm install -g npm@latest
// -g = global
// npm@latest = latest version