Error: ENOENT: no such file or directory, lstat '

I’m running a Next.js 15 App Router project with Clerk authentication. Locally, the app compiles and runs fine using npm run dev, but during build or deployment on Vercel, I encounter the following error:

Error: ENOENT: no such file or directory, lstat '/vercel/path0/.next/server/app/(dashboard)/page_client-reference-manifest.js'

This appears to be related to a missing internal file that Next.js expects but does not generate. I also encounter 404 errors for other assets like:

  • /_next/static/css/app/layout.css
  • /_next/static/chunks/app/layout.js
  • /_next/static/chunks/app/page.js
  • /_next/static/chunks/app-pages-internals.js

Expected behavior:
All necessary files (including page_client-reference-manifest.js) should be generated during the build process, and the app should deploy successfully.
Expected: Vercel should generate this file like it does locally and allow a successful build.

What I’ve Tried So Far:

  • Cleaned .next, node_modules, and package-lock.json
  • Verified 'use client' is used correctly in Clerk pages
  • Re-ran npm install, npm run build
  • Redeployed on Vercel with “Clear Build Cache”
  • Checked that no Clerk components are imported into server components
    • rm -rf .next node_modules && npm install
  • Verified that page.tsx exists under all routed directories inside (dashboard)
  • Verified use client is at the top of all Clerk-related pages
  • Confirmed page_client-reference-manifest.js does generate locally
  • Cleaned and cleared build cache on Vercel multiple times
  • Ensured no imports from route-specific layouts/pages into shared components

Folder Structure
app/
├── layout.tsx
├── page.tsx
├── (dashboard)/
│ ├── layout.tsx
│ ├── page.tsx
│ ├── resumes/
│ │ └── page.tsx
│ ├── resumebuilder/
│ │ └── page.tsx
│ └── editor/
│ └── page.tsx
└── (auth)/
└── sign-in/
└── [[…sign-in]]/
└── page.tsx

Dev Tools + Logs

  • Vercel fails only when building in production — not locally.
  • No broken imports or missing files on local machine.
  • Local next build output does generate page_client-reference-manifest.js under:
.next/server/app/(dashboard)/resumes/
.next/server/app/(dashboard)/editor/
...
  • Why does Vercel not generate page_client-reference-manifest.js on deploy, even though it works locally?
  • Is this a Vercel cache, edge config, or internal optimization issue?
  • Are there any known issues with (segment)/layout.tsx files and manifest generation?

There’s another community post with 404 debugging tips that might be helpful. Please give these solutions a try and let us know how it goes.

A human should be around soon to offer more advice. But you can also get helpful information quickly by asking v0.

I have looked at the other discussions and I have not been able to resolve my issue.

I’ve got the same issue:

Error: ENOENT: no such file or directory, lstat ‘/vercel/path0/node_modules/data-urls/node_modules/whatwg-url/index.js’

No clue why, but if i restart my build manually in vercel it works. If the branch builds from a git push, it works half the time.

Thank you for replying. I finally got it to deploy by deleting the page.tsx file from the dashboard folder because it did not have any logic in it… Just a placeholder

Page

. When I did that it deployed. So it seems as though if there is a page.tsx with no logic in it and not is being used, to delete it.

1 Like

Hey, Monica! :waving_hand:

I’m glad this now works for you. Thank you for coming back and sharing what worked for you! @harrisrobin Let us know if that helps. :smiley:

No that doesn’t help. I do not have empty page.tsx but I do have some that just redirect. This is still an ongoing issue I’ve had for 6+ months now and the only way is to manually rebuild our site when it happens since it’s not consistent.

I’m sorry that you’re still seeing this. Happy to try and figure this out together :smiley:

Could you share a minimal reproducible example for us?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.