๐Ÿ“ฆ

npm

npm (Node Package Manager) is the default package manager for JavaScript and Node.js, maintained by npm Inc., which is now part of GitHub/Microsoft. It's the #2 most-used dev tool in the world, reported in roughly 56.8% of developer surveys, and it's bundled automatically with every Node.js install. Developers use it because it's the standard way to install, version, and share code from npm's registry โ€” the largest package registry on Earth, with millions of published packages.

Quick facts
Type: JavaScript/Node.js package manager
Made by: npm Inc. (part of GitHub / Microsoft)
License: Free / open-source (the npm CLI); the public registry is free to use
Platforms/Hosting: Cross-platform, bundled with Node.js (Windows, macOS, Linux)
Primary use case: Installing, updating, and publishing JavaScript/Node.js packages and managing project dependencies via package.json
Jump to: ExampleGetting startedBest for

Example

Every npm project has a package.json file that declares its dependencies and scripts. Installing a package updates it automatically.

// package.json
{
  "name": "my-app",
  "version": "1.0.0",
  "scripts": {
    "start": "node server.js"
  },
  "dependencies": {
    "express": "^4.19.2"
  }
}
# create a new package.json interactively
npm init -y

# install a package and save it as a dependency
npm install express

# run the "start" script defined above
npm run start

Getting started

npm ships automatically with Node.js โ€” install Node and npm comes along for free.

# after installing Node.js from nodejs.org, verify both
node --version
npm --version

# install a package globally (CLI tools)
npm install -g typescript
Best for: Every Node.js or JavaScript project, from a small script to a large web app โ€” it's the default, near-universal choice unless a team specifically opts into an alternative client like Yarn or pnpm for speed or workspace features.