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
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
Answered by Sumon Chandra
Certainly 👍
View full answer

35 Replies

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
@Toyger What can I do to resolve this issue?
Do you have any opinions on that?
@Sumon Chandra <@536484914221285376> What can I do to resolve this issue? Do you have any opinions on that?
Toyger
oops, I wrongly understood question.
did you use firebase, I see such bugs happened with some earlier versions if firebase was installed.
No, I didn't use Firebase. I used NextAuth and Prisma
@Sumon Chandra No, I didn't use Firebase. I used NextAuth and Prisma
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
It’s 14.0.1
Do I have to remove src folder and set the app folder in root?
@Sumon Chandra Do I have to remove src folder and set the app folder in root?
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.
Thanks @Toyger, I'll change the app folder in root, and i'll inform you that will resolve or not.
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 🙂
Most important things first - remove env file from your repository, you are sharing your mongodb secrets currently 🙂
remember to rewrite repository history after removal
@Z4NR34L remember to rewrite repository history after removal
@Z4NR34L what does it mean!!!
I'm currently testing the deployment of that repository - please give me a few more secconds 😄
Answer
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
If you consider that case as closed You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
@Z4NR34L But still it didn't work for me. 😢
I'm trying to deploy my project but it didn't work.
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
Finally!!! 😃
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 ! ❤️
Happy that I was able to help!