Skip to main content

Package Management

Every language has its own ecosystem for managing dependencies. Here's how different languages handle package management, dependency resolution, and project configuration.

Installing & Managing Dependencies​

# npm (Node Package Manager)
npm init -y # Create package.json
npm install express # Install dependency
npm install -D jest # Install dev dependency
npm install # Install all from package.json
npm update # Update packages
npm uninstall express # Remove package

# yarn (alternative)
yarn init -y
yarn add express
yarn add -D jest
yarn install
yarn remove express

# pnpm (fast alternative)
pnpm install express
pnpm add -D jest

# Config file: package.json
# Lock file: package-lock.json / yarn.lock / pnpm-lock.yaml
# Registry: npmjs.com

Key Takeaways​

  • Centralized vs decentralized registries -- npm, PyPI, Crates.io, NuGet, and Maven Central are centralized; Go uses module proxies (defaulting to proxy.golang.org); Zig uses URL-based fetches with no central registry.
  • Lock files ensure reproducibility -- Most ecosystems use lock files (package-lock.json, Cargo.lock, go.sum, Gemfile.lock, poetry.lock); C/C++ often rely on vendoring or system packages with less guarantees.
  • Tooling maturity varies -- JavaScript has npm/yarn/pnpm; Python has pip plus Poetry/uv; Rust's Cargo is highly integrated; C and C++ use vcpkg, Conan, or CMake FetchContent with more manual setup.
  • Virtual environments isolate dependencies -- Python's venv and Ruby's Bundler provide project-local isolation; Node's node_modules and Go's module cache serve similar goals.
  • C has no standard package manager -- Developers typically use system package managers (apt, brew), vcpkg, or manual compilation; dependency management is largely manual.