What are peer dependencies, and How to fix issues with peer dependencies found in pnpm?
What are peer dependencies, and How to fix issues with peer dependencies found in pnpm?


What are peer dependencies, and How to fix issues with peer dependencies found in pnpm?

Fix the peer dependencies issue in pnpm.

Rajdeep Singh
FrontEnd web
Published in
3 min readMay 16, 2024


PNPM is a very famous package managed in the node community. It is speedy to install any node package locally as compared to npm and yarn.

I hope if you used pnpm on a daily basis, you see the following error:

Issues with peer dependencies found

The peer dependencies error look like this:

➜  react-19 git:(main) ✗ pnpm update  next@14.3.0-canary.63

Packages: +16 -7
Downloading registry.npmjs.org/@next/swc-linux-x64-musl/14.3.0-canary.63: 50.81 MB/50.81 MB, done
Progress: resolved 381, reused 357, downloaded 1, added 1, done
node_modules/.pnpm/sharp@0.33.3/node_modules/sharp: Running install script, done in 130ms

- next
+ next 14.3.0-canary.63

WARN Issues with peer dependencies found
└─┬ next 14.3.0-canary.63
├── ✕ unmet peer react@19.0.0-beta-4508873393-20240430: found 19.0.0-beta-26f2496093-20240514
└── ✕ unmet peer react-dom@19.0.0-beta-4508873393-20240430: found 19.0.0-beta-26f2496093-20240514

Done in 53.4s

What are peer dependencies?

A peer dependency is a package that relies on or depends on a different package. For example, the next package relies on react, and the react-dom package relies on react.

// package.json https://www.npmjs.com/package/next?activeTab=code

"peerDependencies": {
"@opentelemetry/api": "^1.1.0",
"@playwright/test": "^1.41.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sass": "^1.3.0"

When you are installing any package in your project, you need to install peer dependency related to the package; otherwise, your project won’t work.

Why does peer dependencies issue occur?

The peer dependencies issue occurs when a package’s specified peer dependency doesn’t match the version installed in the root project.


You can not install the peer dependencies, which are needed for working.

How to fix issues with peer dependencies found in pnpm?

Some node packages automatically install the peer dependencies package during package installation time.

There are two solution available:

  1. Using .npmrcfile
  2. Using pnpm CLI

Using .npmrcfile

If you face the peer dependencies issue, To fix the peer dependencies, you need to follow the simple guide given below.

  1. Create .npmrc file
  2. Run pnpm update command.

Create .npmrc file

The first step is to create a .npmrc file in your project root level and then paste the following code into it.

# .npmrc


Run pnpm update command.

Lastly run the pnpm update command in your project.

pnpm update

Your peer dependencies issue is fix now.

Using pnpm CLI

There is another solution as well. You can do that using pnpm CLI to fix the peer dependencies issue.

The pnpm CLI has a — save-peer flag option. If you know there is an issue related to peer dependencies with the package you currently install, then you can use the — save-peer flag.

pnpm add --save-peer react@19.0.0-beta-4508873393 react-dom@19.0.0-beta-4508873393

To learn more about frontend developers, reactjs, nextjs, and Linux stuff, follow the frontend web publication on Medium and other updates. You can also follow me on Twitter (X) and Medium.



Rajdeep Singh
FrontEnd web

JavaScript | TypeScript | Reactjs | Nextjs | Rust | Biotechnology | Bioinformatic | Frontend Developer | Author | https://linktr.ee/officialrajdeepsingh