Web
Analytics
top npm commands | Angular | ASP.NET Tutorials

For Consultation : +91 9887575540

Stay Connected :

Most Used NPM Commands

Using of NPM commands is very easy. NPM commands are managed in package.json and package.json is used to manage project’s dependencies.

The following are the top NPM commands.

  • 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 to the package.json file, inside dependencies.
  • npm install module_name –save-dev: Installs a module and adds it to 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 -v: Displays the NPM current 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).