Package managers and dependencies
Install the libraries a project needs, pin their versions with a lock file and keep them up to date.
Why it matters
Almost every project depends on other people's code. Without a lock file, two machines installing "the same" project get different versions — the most common cause of "it works on my machine" builds.
Where it fits
What you will learn
- Tell the manifest (what you ask for) from the lock file (what you got).
- Install exactly the locked versions in CI.
- Update dependencies deliberately, one change at a time.
Before you start
- Git basics✓ Learned
Manifest and lock file
- Manifest —
package.json,composer.json,pyproject.toml: the packages and the version ranges you accept. - Lock file —
package-lock.json,composer.lock: the exact versions that were installed. Commit it for applications.
npm install express # add a dependency, update both files
npm ci # CI and servers: install exactly the lock file
composer install # PHP: install from composer.lock
python -m pip install -r requirements.txt
Tip: Version ranges like ^4.18.0 follow semantic versioning: the caret accepts new minor and patch versions, not a new major one.
Watch out: Every dependency is code that runs with your permissions. Prefer well-maintained packages, and do not add one for something a few lines of your own code can do.
Official documentation and references
Documentation
- npm Docs ↗ Official · npm
- Composer documentation ↗ Official · Composer
- pip documentation ↗ Official · Python Packaging Authority
Guides
- Python Packaging User Guide ↗ Official · Python Packaging Authority
Reference
- npm — package-lock.json ↗ Official · npm
Learn next
- Build artifacts and versioning ›✓ Learned
Related topics
- Build artifacts and versioning✓ Learned
- Dependency and security scanning✓ Learned
Done with this topic?
Reviewed 2026-10-23. Links go to the official documentation unless marked otherwise.