Curated list of useful resources and cheatsheets for web developers
View the Project on GitHub zlatanstajic/ultimate-cheatsheet-for-developers
Default package manager for the JavaScript runtime environment Node.js.
Read more about npm.
See also: Node — JavaScript runtime that npm runs on.
# Where npm was installed
which npm
# Check the version
npm -v
# Searching for packages
npm search [package-name]
# Clean cached packages
npm cache clean --force
# Show funding information for installed packages
npm fund
# Compose security report
npm audit
# Fix security issues
npm audit fix
# Listing packages
npm list
# List outdated packages
npm outdated
# Install all dependencies from package.json
npm install
# Clean install (removes node_modules, uses package-lock.json exactly — preferred in CI)
npm ci
# Install package
npm install [package-name]
# Install package as dev dependency
npm install --save-dev [package-name]
# Update package
npm update [package-name]
# Remove package
npm remove [package-name]
# Install specific version of a package
npm install [package-name]@[version]
# Remove extraneous packages
npm prune
# Run a script defined in package.json
npm run [script-name]
# Initialize a new project (creates package.json)
npm init
# Initialize with defaults (no prompts)
npm init -y
# Updating npm globally
npm install npm@latest -g
# List package is among globally installed packages
npm list -g | grep [package-name]
# Uninstall globally installed package
npm uninstall -g [package-name]
Node.js version manager. Read more at n.
# Install n globally
npm install -g n
# Output versions installed
n
# Install or activate the latest node release
n latest
# Install or activate the latest stable node release
n stable
# Install node [version]
n [version]
# Execute node [version] with [args ...]
n use [version] [args ...]
# Output bin path for [version]
n bin [version]
# Remove the given version(s)
n rm [version ...]
# Output the latest node version available
n --latest
# Output the latest stable node version available
n --stable
# Output the versions of node available
n ls
Run Node.js binaries without installing them globally. Read more at npx.
# Kill Node.js on port number
npx kill-port [port-number]