Skip to content

fix(dev): Gatsby HMR fails with ENOENT for missing node_modules files #451

Description

@jimmyandrade

Summary

Local gatsby develop / HMR stops serving a working app. The browser console reports:

[HMR] connected
[HMR] bundle has 26 errors

followed by many Webpack Module build failed: Error: ENOENT: no such file or directory, open '…/node_modules/…' errors, including:

  • @hot-loader/react-dom/node_modules/scheduler/…
  • axios/lib/defaults.js
  • gatsby-link/index.js
  • gatsby-react-router-scroll/index.js
  • many gatsby/node_modules/@babel/runtime/helpers/** files

Likely cause

Corrupted or incomplete node_modules (often while gatsby develop is still running), plus npm hoisting that left gatsby-link / gatsby-react-router-scroll only nested under gatsby (develop SSR cannot resolve them from .cache).

Acceptance criteria

  • Document recovery steps in TROUBLESHOOTING.md
  • Clean reinstall restores a working module tree
  • npm run develop on Node 18 serves without the 26 HMR ENOENT errors
  • Site loads at http://localhost:8001 (verified HTTP 200)
  • Durable deps: hoist gatsby-link / gatsby-react-router-scroll; override remark-mdx@1.6.22; ensure google-fonts dirs plugin

Resolution

Shipped in #452.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions