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


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 };


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"
Was this page helpful?