Error when running `pnpm db:push`

When i try to pnpm db:push i get this error
dg-system on  main [✘!?] via 🍞 v1.0.11 via  v20.10.0
❯ pnpm db:push

> [email protected] db:push /Users/barsi/Dev/dg-system
> dotenv drizzle-kit push:mysql

node:internal/modules/cjs/loader:598
throw e;
^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './relations' is not defined by "exports" in /Users/barsi/Dev/dg-system/node_modules/drizzle-orm/package.json
at exportsNotFound (node:internal/modules/esm/resolve:294:10)
at packageExportsResolve (node:internal/modules/esm/resolve:641:9)
at resolveExports (node:internal/modules/cjs/loader:591:36)
at Module._findPath (node:internal/modules/cjs/loader:668:31)
at Module._resolveFilename (node:internal/modules/cjs/loader:1130:27)
at Module._load (node:internal/modules/cjs/loader:985:27)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at src/introspect-pg.ts (/Users/barsi/Dev/dg-system/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:18794:24)
at __init (/Users/barsi/Dev/dg-system/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:9:56) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Node.js v20.10.0
 ELIFECYCLE  Command failed with exit code 1.
dg-system on  main [✘!?] via 🍞 v1.0.11 via  v20.10.0
❯ pnpm db:push

> [email protected] db:push /Users/barsi/Dev/dg-system
> dotenv drizzle-kit push:mysql

node:internal/modules/cjs/loader:598
throw e;
^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './relations' is not defined by "exports" in /Users/barsi/Dev/dg-system/node_modules/drizzle-orm/package.json
at exportsNotFound (node:internal/modules/esm/resolve:294:10)
at packageExportsResolve (node:internal/modules/esm/resolve:641:9)
at resolveExports (node:internal/modules/cjs/loader:591:36)
at Module._findPath (node:internal/modules/cjs/loader:668:31)
at Module._resolveFilename (node:internal/modules/cjs/loader:1130:27)
at Module._load (node:internal/modules/cjs/loader:985:27)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at src/introspect-pg.ts (/Users/barsi/Dev/dg-system/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:18794:24)
at __init (/Users/barsi/Dev/dg-system/node_modules/.pnpm/[email protected]/node_modules/drizzle-kit/bin.cjs:9:56) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Node.js v20.10.0
 ELIFECYCLE  Command failed with exit code 1.
Package JSON:
"drizzle-orm": "^0.28.5",
devDeps
"drizzle-kit": "^0.20.7",
"drizzle-orm": "^0.28.5",
devDeps
"drizzle-kit": "^0.20.7",
Solution:
Apparently it didnt like how i had
.$defaultFun(() => createId() )
.$defaultFun(() => createId() )
imported from ~/utils/index.ts...
Jump to solution
5 Replies
HolyByte, The Iron Oxide Jedi
Maybe update to orm 0.29.2 and studio to the latest, remove the pnpm's lock and then do a fresh install of all your node_modules.
dex
dexOP11mo ago
First error also occurs with newly created t3-app
Yamattack
Yamattack11mo ago
you could try to update your dependencies using pnpm update
dex
dexOP11mo ago
done that already to no avail
Solution
dex
dex11mo ago
Apparently it didnt like how i had
.$defaultFun(() => createId() )
.$defaultFun(() => createId() )
imported from ~/utils/index.ts
Want results from more Discord servers?
Add your server