Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npx prisma migrate dev FAILING.. need help #196

Closed
shubhamrawat090 opened this issue Apr 12, 2024 · 11 comments
Closed

npx prisma migrate dev FAILING.. need help #196

shubhamrawat090 opened this issue Apr 12, 2024 · 11 comments

Comments

@shubhamrawat090
Copy link
Contributor

shubhamrawat090 commented Apr 12, 2024

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
Copy link
Contributor

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
Copy link
Contributor

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

working for me

shubhamrawat090 added a commit to shubhamrawat090/daily-code that referenced this issue Apr 13, 2024
@shubhamrawat090
Copy link
Contributor Author

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

@omdhede
Copy link

omdhede commented Apr 13, 2024

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
Copy link

image

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

@kris08052000
Copy link

kris08052000 commented Apr 13, 2024

  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).
redwoodjs/redwood-tutorial#64

@SohailGidwani
Copy link

SohailGidwani commented Apr 13, 2024

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

@shubhamrawat090
Copy link
Contributor Author

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
Copy link

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
Copy link
Contributor Author

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.

hkirat added a commit that referenced this issue Apr 14, 2024
@ganeshkondaka
Copy link

yarn add prisma typescript ts-node @types/node --save-dev

do we need to install the prisma separately...?, but why it is not in the docker file
just asking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants