Closed Naeem-gg closed 2 weeks ago
I am also seeing this behavour
I am also seeing this behavour
The dirty fix for now is not to directly use pnpx
and define some scripts in package.json
and use it with pnpm
. We can use it like this until someone from drizzle looks at this issue. 😢
Or just use npx.
Or just use npx.
Yep, it 💯 depends on personal preferences. I like custom small scripts so that I won't type same commands again n again.
I'm getting a similar issue when running pnpx drizzle-kit generate
, the console output is:
Please install latest version of drizzle-orm
I worked around it by using pnpm exec
instead of pnpx
. So I ran pnpm exec drizzle-kit generate
and then it worked just fine:
2 tables
attendees 4 columns 0 indexes 1 fks
events 4 columns 0 indexes 0 fks
[✓] Your SQL migration file ➜ db/migrations/0000_dusty_starbolt.sql 🚀
I assume that pnpx
prioritizes the package that's installed in the temporary packages folder, and drizzle-kit
is looking in the folder of the script instead of the CWD.
This is an issue with PNPM rather than Drizzle Kit itself. Here's a bit of info regarding PNPM prefixes:
pnpm exec
: Use the locally installed package to execute the command. Recommendedpnpm dlx
: Downloads the package, loads it into memory and runs the command.pnpx
: Deprecated, don't use.
What version of
drizzle-orm
are you using?0.30.2
What version of
drizzle-kit
are you using?0.20.14
Describe the Bug
I was debugging my code when no drizzle-kit command was working, all the commands were giving same error which is
Error: Cannot find module 'drizzle-orm/pg-core'
. I deleted and installed node_modules also but still it was same. One thing noticeable here is I was usingpnpm
and for commandspnpx
. Idk what I thought I just fired the command withnpx
and it worked perfectly fine. I tried other commands also and all of it was fine. So I concluded there might be something wrong with drizzle-kit and pnpm combination.tried this with vercel postgres, postgresjs, and neon (next v14.1.3) please note that if I put some script in package.json for same perpose like
"introspect": "drizzle-kit introspect:pg"
then I can use it with pnpmpnpm introspect
Expected behavior
No response
Environment & setup
nextjs + any postgres + drizzle