npm install with version code example
Example 1: npm check package version
local packages:
~$ npm list
globally installed packages:
~$ npm list -g
specific package:
~$ npm list <package>
Example 2: install exact version npm
npm install <package>@<version>
//example
npm install [email protected]
Example 3: install npm globally
npm install npm@latest -g
Example 4: npm install specific version
$ npm i [email protected]
Example 5: how to install specific package version npm
$ npm install [email protected]
+ [email protected]
added 48 packages from 36 contributors and audited 121 packages in 2.986s
found 0 vulnerabilities
Example 6: how to install latest version of npm package
//For global packages
npm i -g <package name>@latest
npm i -g express@latest
//For loacal packages
npm outdated
npm update
//Manually updating local packages
npm i <package name>@latest
npm update "react" "react-dom"