npm

Node Package Manager

npm Overview

npm is the world's largest software registry and package manager for JavaScript. It consists of a command line client and an online database of public and paid-for private packages, called the npm registry.

Developer

npm, Inc. (now GitHub)

Initial release

January 12, 2010

Written in

JavaScript

License

Artistic License 2.0

Key Features

Installation & Setup

Installation Steps:

  1. Install Node.js which includes npm from official website
  2. Verify installation with: npm -v
  3. Initialize a new project with: npm init
  4. Configure your registry if needed (default is https://registry.npmjs.org/)

Common Commands:

npm install

Install a package and its dependencies.

npm run

Run a script defined in package.json.

npm update

Update packages to their latest version.

npm publish

Publish a package to the registry.

Productivity Tips

npx

Use npx to run packages without installing them globally.

package-lock.json

Commit this file to ensure consistent installs across environments.

npm ci

Use for faster, cleaner installs in CI/CD environments.

npm scripts

Define custom scripts in package.json for common tasks.

Learning Resources