drizzle-orm
drizzle-orm copied to clipboard
[BUG]: drizzle push:pg failed with pnpm
What version of drizzle-orm
are you using?
0.28.6
What version of drizzle-kit
are you using?
0.19.13
Describe the Bug
rel: #1278
drizzle-kit push failed, because of drizzle-orm not found..
$ pnpm dlx drizzle-kit push:pg
.../share/pnpm/store/v3/tmp/dlx-22738 | +51 +++++
.../share/pnpm/store/v3/tmp/dlx-22738 | Progress: resolved 72, reused 51, downloaded 0, added 51, done
node:internal/modules/cjs/loader:1080
throw err;
^
Error: Cannot find module 'drizzle-orm'
Require stack:
- /home/ekusiadadus/.local/share/pnpm/store/v3/tmp/dlx-22738/node_modules/.pnpm/@[email protected]/node_modules/@drizzle-team/studio/index.cjs
- /home/ekusiadadus/.local/share/pnpm/store/v3/tmp/dlx-22738/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.cjs
at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
at Module._load (node:internal/modules/cjs/loader:922:27)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:121:18)
at Object.<anonymous> (/home/ekusiadadus/.local/share/pnpm/store/v3/tmp/dlx-22738/node_modules/.pnpm/@[email protected]/node_modules/@drizzle-team/studio/index.cjs:50678:26)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/ekusiadadus/.local/share/pnpm/store/v3/tmp/dlx-22738/node_modules/.pnpm/@[email protected]/node_modules/@drizzle-team/studio/index.cjs',
'/home/ekusiadadus/.local/share/pnpm/store/v3/tmp/dlx-22738/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/index.cjs'
]
}
Node.js v18.17.1
 ERROR  Command failed with exit code 1: drizzle-kit push:pg
pnpm: Command failed with exit code 1: drizzle-kit push:pg
at makeError (/snapshot/dist/pnpm.cjs)
at handlePromise (/snapshot/dist/pnpm.cjs)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.handler [as dlx] (/snapshot/dist/pnpm.cjs)
at async /snapshot/dist/pnpm.cjs
at async main (/snapshot/dist/pnpm.cjs)
at async runPnpm (/snapshot/dist/pnpm.cjs)
at async /snapshot/dist/pnpm.cjs
package.json
{
"name": "c-chatpdf",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"dependencies": {
"@clerk/nextjs": "^4.24.0",
"@neondatabase/serverless": "^0.6.0",
"@radix-ui/react-slot": "^1.0.2",
"@types/node": "20.6.3",
"@types/react": "18.2.22",
"@types/react-dom": "18.2.7",
"autoprefixer": "10.4.16",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"drizzle-orm": "^0.28.6",
"eslint": "8.49.0",
"eslint-config-next": "13.5.2",
"lucide-react": "^0.279.0",
"next": "13.5.2",
"postcss": "8.4.30",
"react": "18.2.0",
"react-dom": "18.2.0",
"shadcn-ui": "^0.4.0",
"tailwind-merge": "^1.14.0",
"tailwindcss": "3.3.3",
"tailwindcss-animate": "^1.0.7",
"typescript": "5.2.2"
},
"devDependencies": {
"@storybook/addon-essentials": "^7.4.3",
"@storybook/addon-interactions": "^7.4.3",
"@storybook/addon-links": "^7.4.3",
"@storybook/addon-onboarding": "^1.0.8",
"@storybook/blocks": "^7.4.3",
"@storybook/nextjs": "^7.4.3",
"@storybook/react": "^7.4.3",
"@storybook/testing-library": "^0.2.1",
"drizzle-kit": "^0.19.13",
"eslint-plugin-storybook": "^0.6.14",
"storybook": "^7.4.3"
}
}
Expected behavior
work well...
Environment & setup
No response
And you obviously did pnpm install
right?
Hey, i just got the same problem.
pnpm dlx drizzle-kit push:pg
 WARN  2 deprecated subdependencies found: [email protected], [email protected]
Packages: +123
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 191, reused 123, downloaded 0, added 123, done
node:internal/modules/cjs/loader:1137
throw err;
^
Error: Cannot find module 'drizzle-orm/pg-core'
Require stack:
- /Users/5knnbdwm/Library/pnpm/store/v3/tmp/dlx-29672/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs
at Module._resolveFilename (node:internal/modules/cjs/loader:1134:15)
at Module._load (node:internal/modules/cjs/loader:975:27)
at Module.require (node:internal/modules/cjs/loader:1225:19)
at require (node:internal/modules/helpers:177:18)
at src/serializer/pgImports.ts (/Users/5knnbdwm/Library/pnpm/store/v3/tmp/dlx-29672/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:12130:22)
at __init (/Users/5knnbdwm/Library/pnpm/store/v3/tmp/dlx-29672/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:9:56)
at src/utils.ts (/Users/5knnbdwm/Library/pnpm/store/v3/tmp/dlx-29672/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:60515:5)
at __init (/Users/5knnbdwm/Library/pnpm/store/v3/tmp/dlx-29672/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:9:56)
at Object.<anonymous> (/Users/5knnbdwm/Library/pnpm/store/v3/tmp/dlx-29672/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:62167:1)
at Module._compile (node:internal/modules/cjs/loader:1356:14) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/5knnbdwm/Library/pnpm/store/v3/tmp/dlx-29672/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs'
]
}
Node.js v18.19.0
when i first encountered that i thought okay maybe the docs didnt include add that drizzle-orm/pg-core
also needs to be installed. However that doesnt work either.
pnpm install drizzle-orm/pg-core
 ERROR  Command failed with exit code 128: git ls-remote git+ssh://[email protected]/drizzle-orm/pg-core.git HEAD
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
This error happened while installing a direct dependency of /Users/5knnbdwm/Developer/test-nuxt-wss
pnpm: Command failed with exit code 128: git ls-remote git+ssh://[email protected]/drizzle-orm/pg-core.git HEAD
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
at makeError (/Users/5knnbdwm/.asdf/installs/nodejs/18.19.0/lib/node_modules/pnpm/dist/pnpm.cjs:24966:17)
at handlePromise (/Users/5knnbdwm/.asdf/installs/nodejs/18.19.0/lib/node_modules/pnpm/dist/pnpm.cjs:25537:33)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async getRepoRefs (/Users/5knnbdwm/.asdf/installs/nodejs/18.19.0/lib/node_modules/pnpm/dist/pnpm.cjs:110621:23)
at async resolveRef (/Users/5knnbdwm/.asdf/installs/nodejs/18.19.0/lib/node_modules/pnpm/dist/pnpm.cjs:110633:20)
at async resolveGit (/Users/5knnbdwm/.asdf/installs/nodejs/18.19.0/lib/node_modules/pnpm/dist/pnpm.cjs:110584:24)
at async Object.resolve (/Users/5knnbdwm/.asdf/installs/nodejs/18.19.0/lib/node_modules/pnpm/dist/pnpm.cjs:110883:173)
at async run (/Users/5knnbdwm/.asdf/installs/nodejs/18.19.0/lib/node_modules/pnpm/dist/pnpm.cjs:122979:23)
Progress: resolved 21, reused 21, downloaded 0, added 0
I then tried to do the push:pg
using npx instead of pnpm and that worked (also pnpx doesnt work). Then i tried to install the package with npm and that doesnt work either. So i have to assume that there is some problem when using pnpm.
Can confirm that using npx drizzle-kit push:pg
does work, whereas pnpx drizzle-kit push:pg
still causes the Error: Cannot find module 'drizzle-orm/pg-core'
error.
pnpm dlx doesn't work with drizzle-kit.. It's weird ! It should work
still no fix :/
I think this issue is with pnpm and not drizzle. Open to get any suggestions how we can help fixing it. For now I'll close this issue as long it's not drizzle related
@AndriiSherman, the same behavior occurs in pnpm and deno. Given the stacktrace, I assume it's related to how both tools load common js code.
drizzle-kit generate --dialect postgresql --schema ./src/db/schema.ts --out ./src/db/migrations
Error: Cannot find module 'drizzle-orm/pg-core'
Require stack:
- /Users/me/projects/planner/src/db/schema.ts
- /Users/me/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs
To be specific:
drizzle-kit/bin.cjs:14898:13
It fails in the module called pirates
oldLoader(mod, filename);
I didn't dig deeper because it requires understanding of how your build process works and why cjs is used for cli tool. The issue is real and it makes drizzle-kit generate
unusable with pnpm and deno.
Consider reopening it