Next.js Discord

Discord Forum

Everything works just fine in the development, but on Vercel deploy, I can't access the page.

Answered
sh1ro posted this in #help-forum
Open in Discord
Avatar
I have this error message: Error: ENOENT: no such file or directory, scandir
I can't access the page that should render .mdx in the contents folder. How should I fix it? The [detail Github repo](https://github.com/Coder-Blue/noah-blog)
Image
Image
Image
Answered by sh1ro
No one helped so I tried many method on the NextJS Github issues, somehow it works? IDK how =))))

But anyway, I just need to change to the getMDXData(path.resolve(process.cwd(), "src/contents"), and move all the .mdx contents to the main root src directory instead of the app directory.

Thanks for patiently helping me!
View full answer

12 Replies

Avatar
In the [Deploy version](https://noah-pblog.vercel.app/en/blog/post/faq/faq-1) or any .mdx related route, only giving me the Error: 500.
Avatar
@B33fb0n3
Here
Avatar
Ah yea, I saw this thread. However, I am not sure if the scanning of dirs is supported on vercel. If I would guess, it's not supported
Avatar
Some guys actually try to get it work on Next 14. I'm trying to replicate their projects' result, and idk it can't work. How would they do that, idk either?
Avatar
If I would be you, I would save my blog posts inside a database (and a link to my MDX file as well) and my getBlogPosts would return a chunk of recent blogs
Avatar
Oh and somehow, it work with the privacy-policy and terms-and-services, but not with the [slug] contents.
Not the way I really want to, I want to load it local.
Avatar
yea, I thought so too. I guess I am not the right person to solve this thread
Avatar
Sorry for the inconvenience, but thanks for helping.
Avatar
np, I thought you will open another thread and didn't expected that you already had an open thread
Avatar
No one helped so I tried many method on the NextJS Github issues, somehow it works? IDK how =))))

But anyway, I just need to change to the getMDXData(path.resolve(process.cwd(), "src/contents"), and move all the .mdx contents to the main root src directory instead of the app directory.

Thanks for patiently helping me!
Answer