Error when generating SvelteKit tables

When running the
@better-auth/cli generate
command in a SvelteKit project it throws the following error

2025-04-17T14:44:42.264Z ERROR [Better Auth]: [#better-auth]: Couldn't read your auth config. Error: Cannot find module '$env/dynamic/private'


For reference, this is my
src/lib/db/index.js
file where the error is thrown:

import { drizzle } from "drizzle-orm/libsql";
import { createClient } from "@libsql/client";
import * as schema from "./schema";
import { env } from "$env/dynamic/private";

const client = createClient({
    url: env.TURSO_DATABASE_URL,
    authToken: env.TURSO_AUTH_TOKEN,
});

export const db = drizzle(client, { schema });


Thanks in advance!
Was this page helpful?