New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: ENOENT: no such file or directory, scandir '/Users/alejandro/code/fun/remix-quickstart/server/posts' #564
Comments
The tutorial makes it more clear you should use the remix app server now, the file system stuff is relative to the output directory, not the source, go back one more directory since you're actually in "server/posts/{server-output-file}.js" I'll go update it to add this note inline with the file system reading |
thanks @ryanflorence, that fixed it. |
Hi @ryanflorence I got the same issue, I even added the path
But it is still fail on Vercel
Do I miss anything? |
Hello @alejandronanez, could you please share what exactly you did to solve this issue? Did you switch to the Remix App Server even for Vercel deployments? |
I'm also hitting this issue |
make your Posts function like this I solve this problem and its work for me on vercel export async function getPosts() {
const postsPath = await fs.readdir(
`${__dirname}/../../app/posts`,
{ withFileTypes: true }
);
const posts = await Promise.all(
postsPath
.map(async (dirent) => {
const file = await fs.readFile(
path.join(`${__dirname}/../../app/posts`, dirent.name)
);
const { attributes } = parseFrontMatter(file.toString());
return {
slug: dirent.name.replace(/\.mdx/, ""),
title: attributes.title,
};
})
);
return posts;
} |
Work on local dev but still broken on vercel production 😕 |
if you can please share with us your structure and some shots from your code |
Which Remix packages are impacted?
remix
(Remix core)create-remix
@remix-run/architect
@remix-run/cloudflare-workers
@remix-run/dev
@remix-run/express
@remix-run/netlify
@remix-run/node
@remix-run/react
@remix-run/serve
@remix-run/server-runtime
@remix-run/vercel
What version of Remix are you using?
^1.0.3
Steps to Reproduce
In the developer blog tutorial:
💿 Add a getPost function to our post module Put this function anywhere in the app/post.ts module:
When I copy that code in my example, and I go to
http://localhost:3000/posts
I got this errorExpected Behavior
/posts
not to be broken./posts/:slug
not to be brokenActual Behavior
Whenever I visit
/posts/
or/posts/:slug
, I get the error I mentioned above. I already tried using Vercel and Remix Server, but I got the same result.Am I missing something?
FWIW I'm using Node 14.x
Seems to be related to #448
The text was updated successfully, but these errors were encountered: