What is npm?

Why Interviewers Ask This

This is a classic screening question for Node.js roles. Hiring managers ask it early in interviews to gauge your baseline understanding and determine if you can communicate technical concepts clearly.

Answer

npm (Node Package Manager) is the default package manager for Node.js and the world's largest software registry, hosting over 2 million packages. It serves two roles: (1) a CLI tool for installing, updating, and managing JavaScript packages and their dependencies, and (2) an online registry at npmjs.com where developers publish and share packages. npm comes bundled with Node.js. Key commands: npm install <package> — installs a package locally; npm install -g <package> — installs globally; npm init — creates a package.json; npm run <script> — runs a script defined in package.json; npm update — updates packages. Alternatives to npm include Yarn and pnpm, which offer faster installation and better monorepo support.

Pro Tip

Before answering, structure your response: one-line definition → real-world analogy → concrete example from a project. This makes even complex Node.js answers easy to follow.