[Fixed] ERR_PNPM_PEER_DEP_ISSUES: Unmet peer dependencies in pnpm: Step-by-Step Troubleshooting Guide

Executive Summary & Root Cause Analysis: The error ERR_PNPM_PEER_DEP_ISSUES (unmet peer or incorrect peer) occurs when running pnpm install in a repository where strict peer dependency enforcement is active (often via strict-peer-dependencies=true in .npmrc or CI/CD settings) and a package’s declared peerDependencies range is missing or mismatched in your project. Unlike npm v6 or permissive Yarn configurations, pnpm uses a strict, non-flat node_modules symlink structure. Common root causes include: (1) installing a plugin whose peerDependencies specify an older major version (e.g., React 18 vs. React 19 or TypeScript 4 vs. 5), (2) missing a required peer package that was not auto-installed, and (3) conflicting peer versions across workspaces in a monorepo.

Step 1: Quick Fix – Install Missing Peers or Relax Strict Checks

Read the unmet peer dependency tree printed directly above ERR_PNPM_PEER_DEP_ISSUES in your terminal. If a peer package is simply missing, install it explicitly; otherwise, relax strict failure temporarily to unblock installation:

# Option A: Install the missing peer dependency explicitly at the expected version
pnpm add <missing-peer-package>

# Option B: Bypass strict peer dependency failures for the current install
pnpm install --no-strict-peer-dependencies

If you are using pnpm v7 or older where automatic peer installation is off by default, upgrade pnpm or enable auto-install peers in your project config.

Step 2: Configure .npmrc and package.json Peer Dependency Rules

To permanently resolve benign peer warnings across your team and CI/CD pipelines without weakening dependency isolation, configure .npmrc and pnpm.peerDependencyRules in your root package.json:

# In your project root .npmrc file:
auto-install-peers=true
strict-peer-dependencies=false

If you want to keep strict-peer-dependencies=true enabled while suppressing specific known-safe mismatches (such as React or ESLint minor major-range warnings), add peerDependencyRules or overrides to package.json:

{
  "name": "my-pnpm-project",
  "pnpm": {
    "peerDependencyRules": {
      "ignoreMissing": ["@babel/core", "eslint"],
      "allowedVersions": {
        "react": "19",
        "typescript": "5"
      }
    },
    "overrides": {
      "conflicting-pkg": "^2.0.0"
    }
  }
}

Step 3: Alternative Workarounds – Deduplicate and Clean pnpm Store

In monorepos or after upgrading major framework versions, stale resolutions in pnpm-lock.yaml can keep old peer conflicts alive:

  1. Deduplicate redundant package instances across the lockfile:
    # Consolidate compatible dependency versions in pnpm-lock.yaml
    pnpm dedupe
  2. Regenerate node_modules and verify the dependency tree:
    # Remove node_modules and perform a clean reinstall
    rm -rf node_modules
    pnpm install
    
    # Inspect why a specific conflicting peer version is being pulled in
    pnpm why <conflicting-package>

Verification & Testing Steps

Confirm that pnpm resolves your workspace dependencies cleanly with zero blocking peer errors and passes CI lockfile checks:

# Run a clean install simulating CI/CD frozen lockfile behavior
pnpm install --frozen-lockfile

# Verify your project builds and passes tests with the resolved peer versions
pnpm run build && pnpm test

Summary Comparison Table

Resolution Method Scope Strictness Impact Best Used For
pnpm add <missing-peer> Project package.json Preserves full strictness Genuinely missing required peer libraries
strict-peer-dependencies=false in .npmrc Project / Team-wide Converts errors into non-blocking warnings Rapid development with lagging third-party plugins
pnpm.peerDependencyRules in package.json Targeted per package High (Ignores only whitelisted rules) Monorepos & production apps wanting strict safety
pnpm dedupe & pnpm why Lockfile resolution Preserves full strictness Clearing duplicate/stale peer versions in monorepos

Leave a Reply