15 npm Commands that Every Node.js Developer Should Know - GeeksforGeeks

07 Oct, 2021
NPM stands for Node Package Manager and it is the package manager for the Node JavaScript platform. It put modules in place so that node can find them, and manages dependency conflicts intelligently. Most commonly, it is used to publish, discover, install, and develop node programs.
Some Important npm commands every developer should know are:
NPM Install Command: Installs a package in the package.json file in the local node_modules folder.npm installExample:Image shows the use of “npm install” that install package.json and package-lock.json
npm install
Example:
Image shows the use of “npm install” that install package.json and package-lock.json
NPM Uninstall Command: Remove a package from the package.json file and removes the module from the local node_modules folder.npm uninstall Example:Image shows a package ‘lodash’ which is an npm package being un-installed using npm uninstall command
npm uninstall 
Example:
Image shows a package ‘lodash’ which is an npm package being un-installed using npm uninstall command
NPM Update Command: This command updates the specified package. If no package is specified then it updates all the packages in the specified location.npm update Example:the original lodash version 4.17.20 -> updated to 4.17.21 using npm update command
npm update 
Example:
the original lodash version 4.17.20 -> updated to 4.17.21 using npm update command
NPM Global Update Command: This command will apply the update action to each globally installed package.npm update -gExample:npm update -g updates all of the packages if it’s available.
npm update -g
Example:
npm update -g updates all of the packages if it’s available.
NPM Deprecate Command: This command will deprecate the npm registry for a package, providing a deprecation warning to all who attempt to install it.npm deprecate
npm deprecate
NPM Outdated Command: Checks the registry if any (or specified) package is outdated. It prints a list of all packages which are outdated.npm outdatedExample:lodash package as indicated in the terminal is outdated that can be updated
npm outdated
Example:
lodash package as indicated in the terminal is outdated that can be updated
NPM Doctor Command: Checks our environment so that our npm installation has what it needs to manage our JavaScript packages.npm doctorExample:
npm doctor
Example:
NPM Initialize Command Creates a package.json file in our directory. It basically asks some questions and finally creates a package.json file in the current project directory.npm initimage shows the steps involved in npm init command.
npm init
image shows the steps involved in npm init command.
NPM Start Command Runs a command that is defined in the start property in the scripts. If not defined it will run the node server.js command.npm start
npm start
NPM Build Command: It is used to build a package.npm buildExample:Shows that there is a major update is available and can be updated using the command given after the changelog.
npm build
Example:
Shows that there is a major update is available and can be updated using the command given after the changelog.
NPM List Command: Lists all the packages as well as their dependencies installed.npm lsExample:npm ls lists all of the npm packages installed in the package.json file.
npm ls
Example:
npm ls lists all of the npm packages installed in the package.json file.
NPM Version Command: Bumps a package version.npm versionExample:Lists out all packages version installed or used in the project.
npm version
Example:
Lists out all packages version installed or used in the project.
NPM Search Command: Searches the npm registry for packages matching the search terms.npm searchshows the description of the package lodash and all commits and author who made the changes.
npm search
shows the description of the package lodash and all commits and author who made the changes.
NPM Help Command: Searches npm help documentation for a specified topic. It is used whenever the user needs help to get some reference.npm helpExample:
npm help
Example:
NPM Owner Command: Manages ownership of published packages. It is used to manage package owners.npm owner
npm owner
luffysenpai
abhishek0719kadiyan
Node.js-Misc
NodeJS-Questions
JavaScript
Node.js
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Difference between var, let and const keywords in JavaScript
Difference Between PUT and PATCH Request
Remove elements from a JavaScript Array
How to get character array from string in JavaScript?
How to get selected value in dropdown list using JavaScript ?
Installation of Node.js on Linux
How to update Node.js and NPM to next version ?
Node.js fs.readFileSync() Method
Node.js fs.readFile() Method
How to update NPM ?