© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•16mo ago
Nduka Success

Bun:SQLITE error with drizzle

trying to run drizzle studio and push changes using drizzle kit but having this error
Cannot find module 'bun'
Require stack:
- C:\projects\tasks-api\src\env.ts
- C:\projects\tasks-api\drizzle.config.ts
- C:\projects\tasks-api\node_modules\drizzle-kit\bin.cjs
Cannot find module 'bun'
Require stack:
- C:\projects\tasks-api\src\env.ts
- C:\projects\tasks-api\drizzle.config.ts
- C:\projects\tasks-api\node_modules\drizzle-kit\bin.cjs


I have re-installed my packages and i am still having the errors.

my env.ts
import { z } from "zod";
import Bun from "bun";

const envSchema = z.object({
  NODE_ENV: z.enum(["development", "production"]).default("development"),
  PORT: z.coerce.number().default(3002),
  LOG_LEVEL: z
    .enum(["fatal", "error", "warn", "info", "debug", "trace"])
    .default("info"),
  DB_FILE_NAME: z.string(),
});

type EnvSchema = z.infer<typeof envSchema>;

declare module "bun" {
  interface Env extends EnvSchema {}
}

const { data, error, success } = envSchema.safeParse(Bun.env);

if (error) {
  console.error("❌ Invalid env:");
  console.error(JSON.stringify(error.flatten().fieldErrors, null, 2));
  process.exit(1);
}

let env = data!;

export { env };
import { z } from "zod";
import Bun from "bun";

const envSchema = z.object({
  NODE_ENV: z.enum(["development", "production"]).default("development"),
  PORT: z.coerce.number().default(3002),
  LOG_LEVEL: z
    .enum(["fatal", "error", "warn", "info", "debug", "trace"])
    .default("info"),
  DB_FILE_NAME: z.string(),
});

type EnvSchema = z.infer<typeof envSchema>;

declare module "bun" {
  interface Env extends EnvSchema {}
}

const { data, error, success } = envSchema.safeParse(Bun.env);

if (error) {
  console.error("❌ Invalid env:");
  console.error(JSON.stringify(error.flatten().fieldErrors, null, 2));
  process.exit(1);
}

let env = data!;

export { env };


my tsconfig
  "strict": true,
    "jsx": "react-jsx",
    "jsxImportSource": "hono/jsx",
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "module": "esnext", // or "es2022", "system", "node16", "nodenext"
    "target": "es2017", // or higher
    "moduleResolution": "node"
  "strict": true,
    "jsx": "react-jsx",
    "jsxImportSource": "hono/jsx",
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "module": "esnext", // or "es2022", "system", "node16", "nodenext"
    "target": "es2017", // or higher
    "moduleResolution": "node"
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

drizzle-kit and bun:sqlite
Drizzle TeamDTDrizzle Team / help
3y ago
drizzle-kit bindings error with bun using local sqlite file
Drizzle TeamDTDrizzle Team / help
3y ago
Error with Expo Sqlite + Drizzle
Drizzle TeamDTDrizzle Team / help
12mo ago
Bun with drizzle
Drizzle TeamDTDrizzle Team / help
3y ago