npm i with version code example

Example 1: npm version

npm install -g npm@latest

Example 2: install exact version npm

npm install <package>@<version>

//example
npm install express@3.0.0

Example 3: how to install specific package version npm

$ npm install express@4.16.1

+ express@4.16.1
added 48 packages from 36 contributors and audited 121 packages in 2.986s
found 0 vulnerabilities

Example 4: npm package version

// How to increment your project version
Ex: 1.0.0

* npm version patch ---> 1.0.1
* npm version minor ---> 1.1.0
* npm version major ---> 2.0.0

npm version [<newversion> | major | minor | patch | premajor | 
preminor | prepatch | prerelease [--preid=<prerelease-id>] | from-git]

Example 5: npm package at version

npm install <package>@<version>