Installing Packages in NPM

From the NPM Package Manager cheat sheet · Package Management · verified Jul 2026

Installing Packages

Add dependencies to your project

bash
# Install all dependencies
npm install
npm i  # shorthand

# Install specific package
npm install express
npm install express@4.18.0  # specific version

# Install as dev dependency
npm install --save-dev nodemon
npm i -D jest  # shorthand

# Install globally
npm install -g typescript
npm i -g pm2

# Install from git
npm install git+https://github.com/user/repo.git
npm install github:user/repo
🟢 Essential - Most common NPM operation
💡 npm ci is faster for automated environments
📌 Use -D for dev-only tools (testing, building)
⚠️ Global installs can cause version conflicts
⚡ --production skips devDependencies
installpackages

Continue with NPM Package Manager

Save the full cheat sheet or work through every related task.

More NPM tasks

Back to the full NPM Package Manager cheat sheet