Shayokh
Shayokh
Explore posts from servers
DTDrizzle Team
Created by Shayokh on 8/15/2024 in #help
⚠ Error - Top-level await is currently not supported with the "cjs" output format
I am trying to migrate to mysql database. I have already defined the schema and generated the migration files. But I try to migrate, I am getting this weird error -
PS D:\Typescript\drizzle orm\drizzle_test> npm run db:migrate

> drizzle_test@0.1.0 db:migrate
> tsx migrate.ts


node:internal/modules/run_main:115
triggerUncaughtException(
^
Error: Transform failed with 2 errors:
D:\Typescript\drizzle orm\drizzle_test\migrate.ts:6:0: ERROR: Top-level await is currently not supported with the "cjs" output format
D:\Typescript\drizzle orm\drizzle_test\migrate.ts:9:0: ERROR: Top-level await is currently not supported with the "cjs" output format
at failureErrorWithLog (D:\Typescript\drizzle orm\drizzle_test\node_modules\tsx\node_modules\esbuild\lib\main.js:1472:15)
at D:\Typescript\drizzle orm\drizzle_test\node_modules\tsx\node_modules\esbuild\lib\main.js:755:50
at responseCallbacks.<computed> (D:\Typescript\drizzle orm\drizzle_test\node_modules\tsx\node_modules\esbuild\lib\main.js:622:9)
at handleIncomingPacket (D:\Typescript\drizzle orm\drizzle_test\node_modules\tsx\node_modules\esbuild\lib\main.js:677:12)
at Socket.readFromStdout (D:\Typescript\drizzle orm\drizzle_test\node_modules\tsx\node_modules\esbuild\lib\main.js:600:7)
at Socket.emit (node:events:520:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:191:23) {
name: 'TransformError'
}

Node.js v22.3.0
PS D:\Typescript\drizzle orm\drizzle_test> npm run db:migrate

> drizzle_test@0.1.0 db:migrate
> tsx migrate.ts


node:internal/modules/run_main:115
triggerUncaughtException(
^
Error: Transform failed with 2 errors:
D:\Typescript\drizzle orm\drizzle_test\migrate.ts:6:0: ERROR: Top-level await is currently not supported with the "cjs" output format
D:\Typescript\drizzle orm\drizzle_test\migrate.ts:9:0: ERROR: Top-level await is currently not supported with the "cjs" output format
at failureErrorWithLog (D:\Typescript\drizzle orm\drizzle_test\node_modules\tsx\node_modules\esbuild\lib\main.js:1472:15)
at D:\Typescript\drizzle orm\drizzle_test\node_modules\tsx\node_modules\esbuild\lib\main.js:755:50
at responseCallbacks.<computed> (D:\Typescript\drizzle orm\drizzle_test\node_modules\tsx\node_modules\esbuild\lib\main.js:622:9)
at handleIncomingPacket (D:\Typescript\drizzle orm\drizzle_test\node_modules\tsx\node_modules\esbuild\lib\main.js:677:12)
at Socket.readFromStdout (D:\Typescript\drizzle orm\drizzle_test\node_modules\tsx\node_modules\esbuild\lib\main.js:600:7)
at Socket.emit (node:events:520:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:191:23) {
name: 'TransformError'
}

Node.js v22.3.0
26 replies
DTDrizzle Team
Created by Shayokh on 8/14/2024 in #help
Weird numbers in terminal πŸ’€
After the config and defining schema, I ran
npx drizzle-kit generate
npx drizzle-kit generate
and some weird text with numbers came up. It did create migrations folder with sql though.
PS D:\Typescript\drizzle orm\drizzle_test> npx drizzle-kit generate
No config path provided, using default 'drizzle.config.ts'
Reading config file 'D:\Typescript\drizzle orm\drizzle_test\drizzle.config.ts'
Reading schema files:
D:\Typescript\drizzle orm\drizzle_test\drizzle\schema.ts

←[1m1 tables←[22m
←[1m←[22m←[1m←[34musers ←[39m←[22m ←[90m2 columns 0 indexes 0 fks←[39m

[←[32mβœ“β†[39m] Your SQL migration file ➜ ←[1m←[4m←[34mdrizzle\migrations\0000_worried_crusher_hogan.sql←[39m←[24m←[22m πŸš€
PS D:\Typescript\drizzle orm\drizzle_test> npx drizzle-kit generate
No config path provided, using default 'drizzle.config.ts'
Reading config file 'D:\Typescript\drizzle orm\drizzle_test\drizzle.config.ts'
Reading schema files:
D:\Typescript\drizzle orm\drizzle_test\drizzle\schema.ts

←[1m1 tables←[22m
←[1m←[22m←[1m←[34musers ←[39m←[22m ←[90m2 columns 0 indexes 0 fks←[39m

[←[32mβœ“β†[39m] Your SQL migration file ➜ ←[1m←[4m←[34mdrizzle\migrations\0000_worried_crusher_hogan.sql←[39m←[24m←[22m πŸš€
10 replies
DTDrizzle Team
Created by Shayokh on 8/14/2024 in #help
Help! Can't install drizzle-orm
I am absolutely new to drizzle and just prepared a fresh new nextjs project to try it out. Right after my nextjs setup, I tried to install drizzle with mysql2.
npm i drizzle-orm mysql2
npm i drizzle-orm mysql2
Then got this massive error that says -
PS D:\Typescript\drizzle orm\drizzle_test> npm i drizzle-orm mysql2
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: [email protected]
npm error Found: [email protected]
npm error node_modules/react
npm error peer react@"^18.2.0" from [email protected]
npm error node_modules/next
npm error next@"14.2.5" from the root project
npm error peer react@"^18.3.1" from [email protected]
npm error node_modules/react-dom
npm error peer react-dom@"^18.2.0" from [email protected]
npm error node_modules/next
npm error next@"14.2.5" from the root project
npm error react-dom@"^18" from the root project
npm error 2 more (styled-jsx, the root project)
npm error
npm error Could not resolve dependency:
npm error drizzle-orm@"*" from the root project
npm error
npm error Conflicting peer dependency: [email protected]
npm error node_modules/react
npm error peer react@"18.2.0" from [email protected]
npm error node_modules/react-native
npm error peer react-native@">0.73.0" from @op-engineering/[email protected]
npm error node_modules/@op-engineering/op-sqlite
npm error peerOptional @op-engineering/op-sqlite@">=2" from [email protected]
npm error node_modules/drizzle-orm
npm error drizzle-orm@"*" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
PS D:\Typescript\drizzle orm\drizzle_test> npm i drizzle-orm mysql2
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: [email protected]
npm error Found: [email protected]
npm error node_modules/react
npm error peer react@"^18.2.0" from [email protected]
npm error node_modules/next
npm error next@"14.2.5" from the root project
npm error peer react@"^18.3.1" from [email protected]
npm error node_modules/react-dom
npm error peer react-dom@"^18.2.0" from [email protected]
npm error node_modules/next
npm error next@"14.2.5" from the root project
npm error react-dom@"^18" from the root project
npm error 2 more (styled-jsx, the root project)
npm error
npm error Could not resolve dependency:
npm error drizzle-orm@"*" from the root project
npm error
npm error Conflicting peer dependency: [email protected]
npm error node_modules/react
npm error peer react@"18.2.0" from [email protected]
npm error node_modules/react-native
npm error peer react-native@">0.73.0" from @op-engineering/[email protected]
npm error node_modules/@op-engineering/op-sqlite
npm error peerOptional @op-engineering/op-sqlite@">=2" from [email protected]
npm error node_modules/drizzle-orm
npm error drizzle-orm@"*" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
4 replies