What is a npm command?

Experience Level: Junior
Tags: npm

Answer

npm has inbuilt actions that do something. Each action has an identifier using which it can be executed.The identifier is called a command.

An example of npm command is:

  • list - a command that displys all installed modules
  • install - a command that installs all modules mentioned in a file package.json in a property dependencies and devDependencies
  • update - a command that updates all modules that have more recent version than the one youhave installed before
  • outdated - a command that displays a list of outdated modules that your package is using

A command is executed from the command-line by typing:

npm <yourcommand>

If you wanted to run the commands above, you would run

npm list
npm install
npm update
npm outdated
Related npm job interview questions
npm for beginners
npm for beginners

Are you learning npm? Try our test we designed to help you progress faster.

Test yourself