Skip to content

NPM top commands

Last updated on February 28, 2017

Just like composer from PHP ,RubyGems from Ruby ,pip from Python, Maven from Java, NuGet from Microsoft Node.js also has a package manager, Node Package Manager (NPM).

NPM Commands

Here is the list of commonly used top NPM commands –
npm -v: Displays the NPM current version.
npm init: Displays a simple wizard to help you create and describe your new project.
npm install module_name: Installs a module.
npm install -g module_name: Install a global module.
npm install module_name --save: Installs a module and adds it into the package.json file, inside dependencies.
npm install module_name --save-dev: Installs a module and adds it into the package.json file, inside devDependencies.
npm list: Lists all the modules installed on the project.
npm list -g: Lists all the global modules installed on the OS.
npm remove module_name: Uninstalls a module from the project.
npm remove -g module_name: Uninstalls a global module.
npm remove module_name --save: Uninstalls a module from the project and also removes it from the attribute dependencies.
npm remove module_name --save-dev: Uninstalls a module from the project and also removes it from the attribute devDependencies.
npm update module_name: Updates the module version.
npm update -g module_name: Updates the global module version.
npm adduser username: Creates an account to https://npmjs.org.
npm whoami: Displays details of your public NPM profile (you must create an account using the previous command).
npm publish: Publishes a module to npmjs.org (it’s necessary to have an active account first).

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments