question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: Blog Quickstart Netlify: ENOENT: no such file or directory, scandir '/Users/Dev/remix-quick-start-blog/netlify/functions/server/posts'

See original GitHub issue

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

Follow the quick start blog guide (and configure site with Netlify) up to this step https://remix.run/docs/en/dev/tutorials/blog#pulling-from-a-data-source that requires let postsPath = path.join(__dirname, "../posts"); to be added to get the posts.

Navigate to localhost:3000/posts and see the error message ENOENT: no such file or directory, scandir 'remix-quick-start-blog/netlify/functions/server/posts'.

Expected Behavior

Following the tutorial’s instructions of:

💿 Create a "posts/" folder in the root of the project, not in the app directory, but next to it.

mkdir posts
Now add some posts:

touch posts/my-first-post.md
touch posts/90s-mixtape.md

will result in navigating to http://localhost:3000/posts displaying a list of the posts

Actual Behavior

Following the tutorial’s instructions of:

💿 Create a "posts/" folder in the root of the project, not in the app directory, but next to it.

mkdir posts
Now add some posts:

touch posts/my-first-post.md
touch posts/90s-mixtape.md

will result in navigating to http://localhost:3000/posts displays an error message ENOENT: no such file or directory, scandir 'remix-quick-start-blog/netlify/functions/server/posts'. unless the posts folder is moved into the netlify/functions/server folder.

Additional Information

Moving the posts folder into netlify/functions/server resolved the issue for me but the tutorials says to put the posts in the root directory. Is the expected functionality that users should put the posts in the netlify/functions/ folder in order for the project to work as expected? If so, can the tutorial documents be updated? If not, is additional configuration required for Netlify? I opened a PR related to Netlify needing additional setup for the quick start tutorial https://github.com/remix-run/remix/pull/446

I see the Jokes App tutorial mentions:

Remix can be deployed in a large and growing list of JavaScript environments. The “Remix App Server” is a full-featured Node.js server based on Express. It’s the simplest option and it satisfies most people’s needs, so that’s what we’re going with for this tutorial. Feel free to experiment in the future!

Instead of adding instructions for specific deployment targets (the current proposed changes) should a similar disclaimer be added to https://remix.run/docs/en/dev/tutorials/blog instead? to make it clear that the tutorial is assuming the deployment target is Remix App Server? The instructions made it seem like it’s choose your own adventure in terms of which deployment target you choose during the set up process.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
ningo-agilityiocommented, Dec 13, 2021

Hi @ryanflorence I got the same issue, I even added the path

const postsPath = path.join(__dirname, "../..", "posts-data");

But it is still fail on Vercel

ENOENT: no such file or directory, scandir '/var/task/output/server/pages/posts-data'

Do I miss anything?

3reactions
ryanflorencecommented, Feb 19, 2022

I suppose we need to be more clear that this tutorial is an introduction to the moving parts of Remix, not a literal blog tutorial. You can’t use a file system in serveless environments, as stated in the tutorial, you should use a real db.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React App won't deploy due to the following error: "ENOENT
I am attempting to deploy the front-end of my React application to Netlify. Because I have both a frontend and backend, both exist...
Read more >
Error: ENOENT: no such file or directory, scandir
I got the error 'Error: ENOENT: no such file or directory, scandir '**/node_modules/node-sass/vendor', this solution helped me resolve it.
Read more >
Getting Started with Netlify: Creating your first Netlify Site
Learn how to create a git workflow CI/CD pipeline with Netlify that ... By the end of this blog post you will have...
Read more >
Jumpstart your Jamstack monitoring - New Relic
Add observability to your Jamstack application and build process, with the New Relic Netlify plugin and quickstart—no manual setup needed.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found