ljlm0402 / typescript-express-starter

📘 Quick and Easy TypeScript Express Starter
http://npm.im/typescript-express-starter
MIT License
2.68k stars 411 forks source link

[Prisma] Environment variable not found: DATABASE_URL #189

Open ghost opened 1 year ago

ghost commented 1 year ago

Describe the Bug (버그 설명)

prisma schema doesnt find the env variable

Version to Reproduce (현재 사용한 버전)

9.2

Steps to Reproduce (재현 순서)

image

prisma migrate dev --preview-feature

Prisma schema loaded from src\prisma\schema.prisma
Error: Schema validation error - Error (query-engine-node-api library)
Error code: P1012
error: Environment variable not found: DATABASE_URL.
  -->  schema.prisma:6
   | 
 5 |   provider = "sqlite"
 6 |   url      = env("DATABASE_URL")
   | 

Validation Error Count: 1
[Context: getConfig]

Prisma CLI Version : 4.5.0
ghost commented 1 year ago

Are there any workarounds to fix the issue? thanks.

ahmadabbas02 commented 1 year ago

Are there any workarounds to fix the issue? thanks.

I found a workaround by using dotenv cli as shown in prisma docs, you can find information here

In my case: dotenv -e .env.development.local -- prisma migrate dev --preview-feature

ljlm0402 commented 1 year ago

@HijackHornet

Thank you for good information. We will reflect it after correction soon

anthonydibi commented 1 year ago

Still not fixed