conflicting peer dependency when installing drizzle-orm
I am trying to install drizzle orm in a fresh install of Nextjs and have the following error presented
Solution:Jump to solution
I don't think there's really anything Drizzle could do to mitigate this issue, apart from splitting ORM for Native into a completely separate package... Next.js doesn't really support Native out of the box, so fresh Next projects start off with a version of React unconstrained by Native compatibility. But NPM sees that ORM has an optional peer to support Native and demands that your dependencies meet that constraint, even if your project does not use that optional peer.
Solutions (any one should work):
- If your project will not use React Native:
- Use a different package manager with a more flexible resolution strategy (Yarn definitely handles this gracefully, PNPM and Bun probably do too)....
2 Replies
Solution
I don't think there's really anything Drizzle could do to mitigate this issue, apart from splitting ORM for Native into a completely separate package... Next.js doesn't really support Native out of the box, so fresh Next projects start off with a version of React unconstrained by Native compatibility. But NPM sees that ORM has an optional peer to support Native and demands that your dependencies meet that constraint, even if your project does not use that optional peer.
Solutions (any one should work):
- If your project will not use React Native:
- Use a different package manager with a more flexible resolution strategy (Yarn definitely handles this gracefully, PNPM and Bun probably do too).
- Using NPM, install the package with the
--force
or --legacy-peer-deps
flag as suggested in the error message.
- Whether or not your project will use React Native, downgrading react
to 18.2.0
will canonically solve the incompatibility.Yeah, I switched from npm to pnpm and I didn't run into the issue