CLI cant generate using SvelteKits $app import

So i just followed the guide. when i tried generating the db things i run into
ERROR [Better Auth]: [#better-auth]: Couldn't read your auth config. Error: Cannot find module '$app/environment'

import { dev } from '$app/environment';
import { drizzle } from 'drizzle-orm/libsql';
import { createClient } from '@libsql/client';
import { env } from '$env/dynamic/private';

if (!env.DATABASE_URL) throw new Error('DATABASE_URL is not set');
if (!dev && !env.DATABASE_AUTH_TOKEN) throw new Error('DATABASE_AUTH_TOKEN is not set');

const client = createClient({ url: env.DATABASE_URL, authToken: env.DATABASE_AUTH_TOKEN });
export const db = drizzle(client);


not entirely sure why this dosent work in the cli? i could use vite env stuff but still weird error imo
Was this page helpful?