Next.js Discord

Discord Forum

Got error while deploying my NextJS project in Vercel.

Answered
Sumon Chandra posted this in #help-forum
Open in Discord
Avatar
Sumon ChandraOP
My project repo : - https://github.com/sumon-chandra/ecoobazar

When I deploy my project in vercel it gives me this error. It says -------

Error: > Couldn't find any pages or app directory. Please create one under the project root

This error shows when hits this ( "next build prisma generate" ) command.
#vercel-help
Image
Image
Answered by Sumon Chandra
Certainly 👍
View full answer

35 Replies

Avatar
Toyger
probably you are in a wrong folder in shell,
at least in error it shows /vercel/path0
but in vscode project folder name is ecoobazar
Avatar
Sumon ChandraOP
@Toyger What can I do to resolve this issue?
Do you have any opinions on that?
Avatar
Toyger
oops, I wrongly understood question.
did you use firebase, I see such bugs happened with some earlier versions if firebase was installed.
Avatar
Sumon ChandraOP
No, I didn't use Firebase. I used NextAuth and Prisma
Avatar
Toyger
which version of nextjs are you using? are updated it?
I see console detected v14.0.1 but in v14 app should be in root
but in your code src in root and app inside src
Avatar
Sumon ChandraOP
Image
It’s 14.0.1
Do I have to remove src folder and set the app folder in root?
Avatar
Toyger
probably, but it should be like that by default, so I am not sure why your in src, in older versions was src, not sure when they changed it.
Avatar
Sumon ChandraOP
Thanks @Toyger, I'll change the app folder in root, and i'll inform you that will resolve or not.
Avatar
Z4NR34L
src directory still works, could you @Sumon Chandra share us your directory tree inside project so we can verify it?
you shared repository, mb I will come back in a second 🙂
Avatar
Z4NR34L
Most important things first - remove env file from your repository, you are sharing your mongodb secrets currently 🙂
remember to rewrite repository history after removal
Avatar
Sumon ChandraOP
Oops!!!!
Yeah, i'll fix that
@Z4NR34L what does it mean!!!
Avatar
Z4NR34L
I'm currently testing the deployment of that repository - please give me a few more secconds 😄
Avatar
Sumon ChandraOP
Certainly 👍
Answer
Avatar
Z4NR34L
I had just removed api/auth route to get rid of issues with nextauth types as you didn't made that work so far as I can see and the project just builded and deployed 😄
oh, and I had fixed schema.prisma as it was generating client files in wrong place
I'll make an PR in a while
just fix nextauth, deploy with default build settings and would be running perfectly 😉
you can even deploy this project from 0 to be sure that you are using default vercel configuration
https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository

here you will find all you need when removing sensitive data from repository 😄
If you consider that case as closed You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
Avatar
Sumon ChandraOP
@Z4NR34L But still it didn't work for me. 😢
Image
I'm trying to deploy my project but it didn't work.
Avatar
Z4NR34L
again - deploy this project from scratch, delete it and import repository one again with my fixes
and change nothing for start
it was working just like that
Avatar
Sumon ChandraOP
Finally!!! 😃
Avatar
Sumon ChandraOP
After a lot of straggling I deployed my project. I've removed project from vercel and then again I add my project but I got er error 😒. Then I do google search for this particular problem and I found that. That was authOptions I moved the authOptions to lib directory and again re-upload the project in vercel. Again I got er error and that was Prisma setup error 😐. I've find this solution in stack overflow and I update the my prismadb file and re-upload the project in vercel. 🫥
But finally I've successfully deployed my project in vercel. 😅

@Z4NR34L Thanks man !! you are genius ! ❤️
Avatar
Z4NR34L
Happy that I was able to help!