Design System Problems

Version Resolution

January 15, 2026 • 5 min read

Version Resolution

Version resolution is the process package managers use to determine which specific versions to install for dependencies. When dependencies specify ranges rather than exact versions, resolution picks concrete versions satisfying all requirements. Understanding resolution helps predict and troubleshoot dependency behavior.

What Is Version Resolution

Version resolution converts version ranges into specific installed versions. When a design system specifies dependency ^1.2.3, resolution determines whether 1.2.3, 1.5.0, or 1.9.9 actually gets installed. This process considers all requirements across the dependency tree.

Resolution happens during npm install and npm update, following different behaviors. Install with a lockfile uses locked versions. Install without a lockfile or update resolves ranges against the registry. These different modes serve different purposes.

How Version Resolution Works

Resolution algorithms balance satisfying all requirements with efficiency. Understanding the process helps predict behavior.

Single package resolution is straightforward. If only one package requires dependency A, the latest version matching its range is selected. ^1.2.3 resolves to the highest 1.x.x version available.

Multiple requirements complicate resolution. If package B requires A@^1.0.0 and package C requires A@^1.5.0, resolution must find a version satisfying both. Version 1.5.0 or higher works. If requirements are incompatible (B requires A@^1.0.0 and C requires A@^2.0.0), resolution must handle the conflict.

Conflict handling varies by package manager. npm may install multiple versions of the same package at different points in node_modules. This allows each requiring package to see its expected version but increases bundle size and can cause issues with singleton packages.

Lockfiles record resolution results. Once resolution completes, the specific versions are recorded. Subsequent installs use these locked versions rather than re-resolving, ensuring reproducibility.

Key Considerations

Common Questions

How does hoisting affect version resolution?

Hoisting moves packages up the node_modules tree to reduce duplication. Understanding hoisting helps predict which version code actually uses.

Flat node_modules is the goal. npm attempts to place packages at the top level of node_modules. If multiple packages require the same dependency with compatible ranges, one version is hoisted to serve all.

Conflicts prevent hoisting. If package B requires A@1.x and package C requires A@2.x, both cannot be hoisted. One version goes to the top level; the other goes into the requiring package’s own node_modules.

The hoisted version matters for singletons. Packages expecting only one instance (like React) can break with multiple versions. The hoisted version is what most code sees. Nested versions may cause issues.

Resolution order affects hoisting. Which version gets hoisted depends on resolution order, which can vary. Lockfiles ensure consistent hoisting by recording the resolved tree structure.

How can teams troubleshoot resolution issues?

Resolution problems manifest as unexpected versions, conflicts, or runtime errors. Several tools and techniques help diagnose issues.

npm explain shows why a package is installed. Running npm explain package-name reveals which dependencies require it and what version constraints apply. This helps understand complex requirement chains.

npm ls lists the installed dependency tree. Options like npm ls package-name show where a package appears. Multiple listings indicate duplicate installations.

Lockfile inspection reveals resolved versions. Examining package-lock.json shows exactly what was resolved. Comparing lockfiles between environments reveals discrepancies.

Clean installation eliminates cached state. Deleting node_modules and package-lock.json, then running npm install, forces fresh resolution. This can resolve issues from corrupted or outdated lockfiles.

Summary

Version resolution converts version ranges into specific installed versions. The process satisfies all requirements across the dependency tree, handling conflicts through duplicate installation when necessary. Lockfiles record resolution results for reproducibility. Understanding resolution helps predict behavior and troubleshoot issues.

Buoy scans your codebase for design system inconsistencies before they ship

Detect Design Drift Free
← Back to Versioning Releases