npm/pnpm/yarn
Install Commands
Install packages and manage your node_modules with npm. Learn the difference between dependencies, devDependencies, and peerDependencies, and control exact versions with lockfiles.
11 commands
Pro Tips
Use 'npm ci' in CI pipelines instead of 'npm install' — it's faster and guarantees reproducible builds from package-lock.json.
Use 'npm install --save-exact pkg' to pin exact versions and avoid unexpected updates.
Use 'npm install -D pkg' for development-only dependencies (testing, building, linting).
Common Mistakes
Always commit package-lock.json. Without it, different team members may get different dependency versions.
Running 'npm install' with '--force' or '--legacy-peer-deps' can hide real dependency conflicts. Investigate the root cause.