W
Wasp-langβ€’7mo ago
Craig

Can't open input file .../project-name/node_modules/.bin/prisma when running wasp db migrate-dev

I'm following the tutorial and everything has been working well through step 3 (Pages & Routes). During step 4 I've added the task entity in main.wasp entity Task {=psl id Int @id @default(autoincrement()) description String isDone Boolean @default(false) psl=}
I stopped (ctrl+c) the process in the terminal and run the wasp db migrate-dev command. I'm receiving the following error ~/my-wasp-todo-project wasp db migrate-dev 🐝 --- Compiling wasp project... -------------------------------------------------- βœ… --- Successfully completed npm install. ---------------------------------------- 🐝 --- Setting up database... ----------------------------------------------------- [ Db ] [-] Removed tables [ Db ] - Task βœ… --- Database successfully set up. ---------------------------------------------- 🐝 --- Building SDK... ------------------------------------------------------------ βœ… --- SDK built successfully. ---------------------------------------------------- βœ… --- Your wasp project has successfully compiled. ------------------------------- 🐝 --- Starting database migration... --------------------------------------------- -c: can't open input file: "/teamspace/studios/this_studio/my-wasp-todo-project/node_modules/.bin/prisma" migrate dev --schema "/teamspace/studios/this_studio/my-wasp-todo-project/.wasp/out/db/schema.prisma" --skip-generate --skip-seed ❌ --- [Error] Migrate dev failed: ------------------------------------------------ Migrate (dev) failed with exit code: 127
4 Replies
kapa.ai
kapa.aiβ€’7mo ago
Hi @Craig. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error message you're seeing suggests that the Prisma CLI might not have been installed correctly or at all. This can happen if the project's dependencies haven't been installed yet, or if there was an issue during the installation. One possible solution to this issue is to ensure that the Prisma CLI is installed as part of your project's dependencies. You can do this by running the npm install command in your project's root directory. This should install all the necessary dependencies listed in your package.json file, including the Prisma CLI. If you've already done this and are still encountering the issue, it's possible that there might be a problem with the Prisma CLI installation itself. In this case, you might want to try uninstalling and then reinstalling the Prisma CLI. If the problem persists, it could be due to a known issue with the Wasp framework where migrate commands can be run before the Prisma CLI is installed. In this case, the process can freeze or fail. The Wasp team suggests that db commands should run code generation and npm install before doing their stuff. Or they could check if it was ever done (e.g. we can save that info in .wasproot file) and then do it only if it is needed (source (https://github.com/wasp-lang/wasp/issues/56)). If none of the above solutions work, I would recommend reaching out to the Wasp community or the Prisma team for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Craig, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Craig
CraigOPβ€’7mo ago
@kapa.ai When I run wasp db studio I see the Task Models, but when I click on it I see the following error - 'Message: Error in Prisma Client request: Invalid prisma.task.findMany() invocation: The table main.Task does not exist in the current database.
Query: { "modelName": "Task", "operation": "findMany", "args": { "take": 100, "skip": 0, "select": { "id": true, "description": true, "isDone": true } } } '
kapa.ai
kapa.aiβ€’7mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- The error message you're seeing suggests that the Task table does not exist in your database. This could be due to a few reasons: 1. You might not have run the database migration after defining the Task entity. After defining an entity in Wasp, you need to run wasp db migrate-dev to update the database schema to include this entity (source (https://wasp-lang.dev/docs/tutorial/entities)). 2. There might be an issue with your database connection. Ensure that your database is running and that your connection string (usually stored in a .env file) is correct. 3. There might be an issue with the Prisma Client or the Prisma CLI. Try reinstalling them by deleting your node_modules folder and running npm install again. If you've checked all of these and are still encountering the issue, it might be a good idea to reach out to the Wasp community or the Prisma team for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Craig, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
martinsos
martinsosβ€’7mo ago
Ok, so you see that error Task does not exist because migration didn't work out, so that makes sense. Question is, why did migration fail for you? You got an error message that it can't open that file. That seems to be the source of trouble. Can you tell me at which path is your wasp project you are woorking on, is it /teamspace/studios/this_studio/my-wasp-todo-project/? Btw this looks a bit peculiar, is this some kind of cloud setup, what is teamspace? Can you check manually on disk if file /teamspace/studios/this_studio/my-wasp-todo-project/node_modules/.bin/prisma exists? If it does, is it possible that for some reason wasp wouldn't have permissions to run it?
Want results from more Discord servers?
Add your server