drizzle-team / drizzle-orm

Headless TypeScript ORM with a head. Runs on Node, Bun and Deno. Lives on the Edge and yes, it's a JavaScript ORM too 😅
https://orm.drizzle.team
Apache License 2.0
21.52k stars 487 forks source link

[BUG]:Dependency conflict error with React 18.3.1 during installation #2401

Open shockValue666 opened 1 month ago

shockValue666 commented 1 month ago

What version of drizzle-orm are you using?

0.30.10

What version of drizzle-kit are you using?

0.21.4

Describe the Bug

I encountered a dependency conflict error while trying to install drizzle-orm in a project using react@18.3.1.

Steps to Reproduce 1.init project

npx create-react-app my-app
cd my-app
  1. attempt to install drizzle-orm
    npm install drizzle-orm

i was expecting to be normally installed, instead i got this error;

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: web@0.1.0
npm ERR! Found: react@18.3.1
npm ERR! node_modules/react
npm ERR!   peer react@"^18.2.0" from next@14.2.3
npm ERR!   node_modules/next
npm ERR!     next@"14.2.3" from the root project
npm ERR!   peer react@"^18.3.1" from react-dom@18.3.1
npm ERR!   node_modules/react-dom
npm ERR!     peer react-dom@"^18.2.0" from next@14.2.3
npm ERR!     node_modules/next
npm ERR!       next@"14.2.3" from the root project
npm ERR!     react-dom@"^18" from the root project
npm ERR!   2 more (styled-jsx, the root project)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! drizzle-orm@"*" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: react@18.2.0
npm ERR! node_modules/react
npm ERR!   peer react@"18.2.0" from react-native@0.74.1
npm ERR!   node_modules/react-native
npm ERR!     peer react-native@">0.73.0" from @op-engineering/op-sqlite@6.0.4
npm ERR!     node_modules/@op-engineering/op-sqlite
npm ERR!       peerOptional @op-engineering/op-sqlite@">=2" from drizzle-orm@0.30.10
npm ERR!       node_modules/drizzle-orm
npm ERR!         drizzle-orm@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! /Users/nothing/.npm/_logs/2024-05-30T12_10_38_962Z-eresolve-report.txt

Expected behavior

The drizzle-orm package should install without dependency conflicts.

Environment & setup

{ "name": "web", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "dotenv": "^16.4.5", "drizzle-orm": "^0.30.10", "next": "14.2.3", "postgres": "^3.4.4", "react": "^18", "react-dom": "^18" }, "devDependencies": { "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", "drizzle-kit": "^0.21.4", "eslint": "^8", "eslint-config-next": "14.2.3", "postcss": "^8", "tailwindcss": "^3.4.1", "typescript": "^5" } }

tejasvajaitly commented 1 month ago

I am having the exact same issue.

arjunyel commented 1 month ago

Work around by adding this to my package.json

{
  "overrides": {
    "react": "rc",
    "drizzle": "0.31.0"
  }
}
echo292 commented 1 month ago

I'm getting the same "Found: react@18.3.1" error on other packages. Does anyone know what the culprit is?

Both of these return "empty" npm list -g react npm list react

FacundoLucci commented 1 month ago

https://stackoverflow.com/questions/78412358/i-am-getting-an-error-when-install-the-drizzle-orm-npm-package-in-my-nextjs-14-a the first solution here helped me.