🐕

npm i drizzle-orm @neondatabase/serverlessが実行できないを解決

2024/05/05に公開

問題

データベースをNeonを使って構築しようとしましたが、npm i drizzle-orm @neondatabase/serverlessを実行しても、下記のようなエラーが出てインストールできませんでした。

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: one@0.1.0
npm ERR! Found: react@18.3.1
npm ERR! node_modules/react
npm ERR!   peer react@">=18" from @clerk/clerk-react@5.0.3
npm ERR!   node_modules/@clerk/clerk-react
npm ERR!     @clerk/clerk-react@"5.0.3" from @clerk/nextjs@5.0.6
npm ERR!     node_modules/@clerk/nextjs
npm ERR!       @clerk/nextjs@"^5.0.6" from the root project
npm ERR!   peer react@">=18" from @clerk/nextjs@5.0.6
npm ERR!   node_modules/@clerk/nextjs
npm ERR!     @clerk/nextjs@"^5.0.6" from the root project
npm ERR!   28 more (@clerk/shared, @radix-ui/react-compose-refs, ...)
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@5.0.6
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.

解決策

reactのバージョンが18になっていたため

npm i react

を実行してバージョンを上げたら解決しました。

Discussion