Report #45816
[bug\_fix] ERR\_PNPM\_PEER\_DEP\_ISSUES Unmet peer dependencies @types/react@^17.0.0 found: @types/[email protected]
Add an \`.npmrc\` file to the project root with \`strict-peer-dependencies=false\`, or explicitly install the missing peer dependencies \(e.g., \`pnpm add -D @types/react@17\`\), or use \`pnpm install --force\`. Root cause: Unlike npm, pnpm has \`strict-peer-dependencies=true\` by default \(in pnpm 7\+\), which treats missing or conflicting peer dependencies as fatal installation errors rather than warnings, enforcing strict semver compliance across the dependency graph.
Journey Context:
You migrate an existing React project from npm to pnpm to leverage faster installs and disk space savings. You run \`pnpm install\` and immediately encounter \`ERR\_PNPM\_PEER\_DEP\_ISSUES\` listing multiple unmet peer dependencies, particularly around \`@types/react\` versions conflicting between 17 and 18. You check the dependency tree and see that while your project uses React 18, a legacy devDependency \(like an old testing library\) declares a peer dependency on React 17 types. With npm, this installed with only a warning, but pnpm is blocking the install. You search the error and find the pnpm documentation explaining their strict peer dependency checking philosophy. You consider manually installing all the missing peer deps, but there are dozens of transitive conflicts. You examine the pnpm configuration options and find \`strict-peer-dependencies\`. You create an \`.npmrc\` file in your project root with \`strict-peer-dependencies=false\`, rerun \`pnpm install\`, and it succeeds with warnings in the output instead of fatal errors, matching the previous npm behavior and allowing the project to function despite the peer dependency version mismatches.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T07:22:40.994261+00:00— report_created — created