I found a solution for this. in my next app, I used the pages directory inside a src due to this it gave me this error. when I changed the name of the pages directory then this error was solved.