code100x / daily-code

https://projects.100xdevs.com/
830 stars 1.01k forks source link

npx prisma migrate dev FAILING.. need help #196

Closed shubhamrawat090 closed 7 months ago

shubhamrawat090 commented 7 months ago

I did these steps

  1. Updated my fork
  2. Cloned the repo
  3. Ran yarn install
  4. cd /packages/db
  5. cp .env.example .env
  6. Created a postgres container via docker
  7. replaced the db URL with DATABASE_URL="postgresql://postgres:mysecretpassword@localhost:5432/postgres" in .env
  8. npx prisma migrate dev here is where it fails

Screenshot 2024-04-12 221140

I am using a windows machine. I don't know if that's causing any issues. If yes, then urgent help is needed there. What I have noticed that it searches in this path D:\Harkirat_Codebase\daily-code\node_modules\node_modules\prisma\build\index.js Here node_modules is 2 times in the path. How did it take this path and how to I change/fix this.

ANYONE WHO HAS RAN INTO THIS ISSUE AND FIXED IT PLEASE DO HELP.

piyushhsainii commented 7 months ago

i ran this into this issue

solution -

cd into /packages/db/prisma

then run cmd yarn add prisma

then run npx prisma migrate dev

and it fixed my error

vibhaw1904 commented 7 months ago

@shubhamrawat090 you can run 1.yarn prisma migrate dev 2.yarn seed:db

working for me

shubhamrawat090 commented 7 months ago

@vibhaw1904 Thanks these helped. I'll push a PR for having these in the readme.

omdhede commented 7 months ago

use yarn add prisma typescript ts-node @types/node --save-dev in packages/db cd packages/db yarn add prisma typescript ts-node @types/node --save-dev then use npx prism generate

it works

SohailGidwani commented 7 months ago

image

even after performing the given steps I'm still getting this error

kris08052000 commented 7 months ago
  1. cd daily-code
  2. yarn install
  3. cd /packages/db 4.cp .env.example .env 5.Update the .env file with the database url 6.yarn prisma migrate dev 7.yarn prisma db seed
  4. cd ../..
  5. yarn run dev

This could solve your issue. I went in this above steps and it worked well for me.

I don't know why the f!uck this "Module not found" issue occur every time when i i go with NPM, even it occurred for me while installing 100xdev.app (cms). https://github.com/redwoodjs/redwood-tutorial/issues/64

SohailGidwani commented 7 months ago

1.It migrates perfectly

  1. When I try to seed the DB it gives this first image
  2. then I ran this command yarn add typescript ts-node @types/node
    installed all of it
  3. then again if I try to seed the DB it gives this image
  4. and same for the yarn command image
shubhamrawat090 commented 7 months ago

1.It migrates perfectly 2. When I try to seed the DB it gives this first image 3. then I ran this command yarn add typescript ts-node @types/node installed all of it 4. then again if I try to seed the DB it gives this image 5. and same for the yarn command image

Try clearing your DB and then prisma generate + seed again. Or what I did was started a new postgres container and re-ran migrate + generate + seed again and that fixed it for me.

SohailGidwani commented 7 months ago

1.It migrates perfectly 2. When I try to seed the DB it gives this first image 3. then I ran this command yarn add typescript ts-node @types/node installed all of it 4. then again if I try to seed the DB it gives this image 5. and same for the yarn command image

Try clearing your DB and then prisma generate + seed again. Or what I did was started a new postgres container and re-ran migrate + generate + seed again and that fixed it for me.

I did try this, but I suppose the issue is with Neon db, it takes longer than 10 secs to seed the remote db so it fails

shubhamrawat090 commented 7 months ago

1.It migrates perfectly 2. When I try to seed the DB it gives this first image 3. then I ran this command yarn add typescript ts-node @types/node installed all of it 4. then again if I try to seed the DB it gives this image 5. and same for the yarn command image

Try clearing your DB and then prisma generate + seed again. Or what I did was started a new postgres container and re-ran migrate + generate + seed again and that fixed it for me.

I did try this, but I suppose the issue is with Neon db, it takes longer than 10 secs to seed the remote db so it fails

In that case I suggest using docker to run a postgres container locally and using that. It will be much faster that way.