Got error while deploying my NextJS project in Vercel.
Answered
Sumon Chandra posted this in #help-forum
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
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
35 Replies
Toyger
probably you are in a wrong folder in shell,
at least in error it shows
but in vscode project folder name is
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?
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.
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
Toyger
which version of nextjs are you using? are updated it?
I see console detected v14.0.1 but in v14
but in your code
I see console detected v14.0.1 but in v14
app
should be in rootbut in your code
src
in root and app
inside src
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
I'm currently testing the deployment of that repository - please give me a few more secconds 😄
Certainly ðŸ‘
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
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 😄
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
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
But finally I've successfully deployed my project in vercel. 😅
@Z4NR34L Thanks man !! you are genius ! â¤ï¸
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!