NPM commands

npm update

Updates dependencies that are not fixed. That is does not start with ^ or ~ signs.

npm outdated

Shows the versions that will be updated but does not actually do the update. For example for the following package.json file:

{"name": "test-package","version": "1.0.0","dependencies": {"lodash": "~4.15.2","express": "^4.17.2"
}
}
Package  Current  Wanted   Latest  Location
express MISSING 4.17.2 4.17.2 test-package
lodash MISSING 4.16.6 4.17.21 test-package

npm show <dependency name> versions

This command shows all the versions available for the dependency.

npm show <dependency name> version

This command shows current version for the dependency.

npm install <dependency name>@latest or version number

This will install the latest version or the specific version mentioned. For example npm install lodash@latest or npm install lodash@4.17

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ayesha M

Ayesha M

I am a software developer, who is easily intrigued by anything tech and is always thriving to make software development more inclusive and empathetic.