NPM Cheat Sheet

NPM which stands for Node Package Manager is a package manager for javascript. This tool simply allows you to download packages for your javascript project. In order to use npm, one must have to know some commands at his or her fingertips. This blog post therefore covers the most used commands that will be needed in order to quickly start up your web project in javascript. You should have npm installed on your machine before you can run these commands. Download npm from

1. npm -v OR npm –version : This gives you the current version of npm installed on your machine.
2. npm init: This command initializes your web project by providing you with a package.json file for your project.
3. npm install #package-name# –save(npm install lodash –save) – This command installs local packages for your project.
4. npm install lodash@4.17.3 –save: Install specific version of a package onto your project.
5. npm update lodash –save : Update the lodash package in your project.
6. npm install -g nodemon : Install global packages that will be available for usage outside your project
7. npm remove -g nodemon : Remove global packages
8. npm install live-server –save-dev : Install live-server as a dev dependency in your project.
9. npm list : List packages in your project.
10. npm remove gulp –save-dev : Remove dev dependency package from your project.
11. npm remove lodash –save : Remove lodash package from your project.


Versions of packages in package.json
Version 4.17.3
4 represents major version
17 represents minor version
3 represents patch version

“dependencies”: {
“lodash”: “^4.17.11”
1. lodash^4.17.3: Latest minor version of lodash
2. lodash~4.17.3: latest patch version of lodash
3. lodash@4.17.3: exact version you’ve described
4. lodash *: latest major version of lodash

These are some few must know npm commands. If you know of other useful npm commands, Kindly comment them below 🙂