Hello,
If you too facing this error : Module not found: Error: Can’t resolve ‘private-next-pages/’ in ‘/vercel/path0’
while deploying your NextJs project over Vercel platform, please follow what solution and mistake I was doing.
As, I tried to debug this error by right away check the the next in the log highlighted (in screenshot above) recommending to following alias rule to be set if you have touched you next.config.js file with any webpack settings.
In my case I did have to touched the next.config.js file and so I have add the same lines of code recommend in the follow link of Next.js doc
But for me still I didn’t found the right solution, because was in the naming of folder under nextjs project.
Basically, I was loading the static content into the dynamic route in Nextjs (Like example reference here).
What I have missed was the name of the folder under pages directory I have created named as “learn” it should be similar to name “posts” as created one at root level of the project to hold the “.md” or “.html” file content to pass down to dynamic route page which will be under /pages/posts/[id].js
Sharing here screenshot of the directory where the naming was a mistake
After renaming the folder name “learn” to “posts” the error went off and found my deployment working successfully.
Hope this small mistake tip help you to solve this problem.
If you have found any mistake in the post. Please don’t hesitate to hit me on my email jat@doableyo.com to rectify.
Enjoyed reading this? How about sharing with your friends or in groups, this would help!
Thanks, Happy Learning!