vercel / next.js

The React Framework
https://nextjs.org
MIT License
123.06k stars 26.29k forks source link

ENOENT: no such file or directory, stat '/vercel/path0/.vercel/output/functions/_next/data/4btXsoRTcvcyFLza13g3H/index.json.func' #40970

Closed willyhuang18 closed 1 year ago

willyhuang18 commented 1 year ago

Verify canary release

Provide environment information

image

What browser are you using? (if relevant)

Chrome

How are you deploying your application? (if relevant)

No response

Describe the Bug

the file it mentions, I checked it, and it actually exists.

Expected Behavior

Deployment should be successful, or if it's the intended behaviour that index page cannot return 404, it should be documented.

Link to reproduction

https://github.com/willyhuang18/Front-End-PlayGround/tree/master/will-portfolio

To Reproduce

run 'vercel build' and then run 'vercel deploy --prebuilt'

huzaifali835 commented 1 year ago

I'm having the same problem. If you overtake this problem. Kindly tell me this as well.

ijjk commented 1 year ago

Hi, can you please provide a full reproduction/deployment? It seems the provided one requires CMS access and when commented out doesn't reproduce.

Marty-jr-95 commented 1 year ago

Am facing same problem with deploying same exact build.. If you stumble upon solution please help.

ijjk commented 1 year ago

@Marty-jr-95 if you can share a deployment/repo we can investigate this much easier as the provided reproduction is not reproducing the error for us.

odinahka commented 1 year ago

I encountered the same problem while trying to deploy from vercel cli.

image

I have looked for the directory that is said to be missing on my local .vercel folder and it is there as you can see in the attached image, I am still confused on why it is not part of the deployment files sent to vercel's server for deployment. The solution would be appreciated

pepper11com commented 1 year ago

Got the same problem on my end...

pepper11com commented 1 year ago

I found a solution that worked for me. I just copied the folder inside data so that's 4btXsoRTcvcyFLza13g3H (the whole folder), then I deleted the folder and pasted it back in. This worked for me...

drumsmanku commented 1 year ago

I just deleted the whole folder inside 'data' folder...and for some reason it worked.

ijjk commented 1 year ago

Can someone seeing this issue share additional context e.g. the requested npx next info output their OS/a deployment?

odinahka commented 1 year ago

@ijjk this is it below; I updated to the latest canary version but the issue still persists.

Operating System: Platform: win32 Arch: x64 Version: Windows 10 Pro Binaries: Node: 16.14.2 npm: N/A Yarn: N/A pnpm: N/A Relevant packages: next: 12.3.1 eslint-config-next: 12.3.1 react: 18.2.0 react-dom: 18.2.0

warn - Latest canary version not detected, detected: "12.3.1", newest: "12.3.2-canary.18".
Please try the latest canary version (npm install next@canary) to confirm the issue still exists before creating a new issue. Read more - https://nextjs.org/docs/messages/opening-an-issue

mirzazohaib commented 1 year ago

I just deleted the whole folder inside 'data' folder...and for some reason it worked.

worked for me as well for Preview Environment only....still givind error on Production...but I wonder why this happen...

[00:21:50.504] Retrieving list of deployment files... [00:21:53.147] Downloading 66 deployment files... [00:21:53.713] Looking up build cache... [00:21:53.833] Build Cache not found [00:21:53.882] Running "vercel build" [00:21:54.538] Vercel CLI 28.4.6 [00:21:54.942] Installing dependencies... [00:21:55.370] yarn install v1.22.17 [00:21:55.440] [1/4] Resolving packages... [00:21:55.669] [2/4] Fetching packages... [00:22:16.606] [3/4] Linking dependencies... [00:22:23.665] [4/4] Building fresh packages... [00:22:24.175] Done in 28.81s. [00:22:24.206] Detected Next.js version: 12.3.1 [00:22:24.209] Running "yarn run build" [00:22:24.544] yarn run v1.22.17 [00:22:24.584] $ next build [00:22:25.150] Attention: Next.js now collects completely anonymous telemetry regarding usage. [00:22:25.150] This information is used to shape Next.js' roadmap and prioritize features. [00:22:25.151] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL: [00:22:25.151] https://nextjs.org/telemetry [00:22:25.151] [00:22:25.285] info - Linting and checking validity of types... [00:22:28.127] [00:22:28.127] ./components/ExperienceCard.tsx [00:22:28.128] 37:13 Warning: Do not use <img> element. Use <Image /> from next/image instead. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element [00:22:28.128] [00:22:28.129] ./components/Hero.tsx [00:22:28.129] 29:7 Warning: Do not use <img> element. Use <Image /> from next/image instead. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element [00:22:28.130] [00:22:28.130] ./components/Projects.tsx [00:22:28.131] 48:19 Warning: Do not use <img> element. Use <Image /> from next/image instead. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element [00:22:28.131] [00:22:28.132] ./components/Skill.tsx [00:22:28.132] 25:9 Warning: Do not use <img> element. Use <Image /> from next/image instead. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element [00:22:28.133] 25:9 Warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text [00:22:28.133] [00:22:28.134] info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules [00:22:30.751] info - Creating an optimized production build... [00:22:42.086] info - Compiled successfully [00:22:42.086] info - Collecting page data... [00:22:42.773] Error: Configuration must contain projectId [00:22:42.774] at exports.initConfig (/vercel/path0/node_modules/@sanity/client/lib/config.js:42:11) [00:22:42.774] at SanityClient.config (/vercel/path0/node_modules/@sanity/client/lib/sanityClient.js:89:25) [00:22:42.775] at new SanityClient (/vercel/path0/node_modules/@sanity/client/lib/sanityClient.js:53:8) [00:22:42.775] at SanityClient (/vercel/path0/node_modules/@sanity/client/lib/sanityClient.js:50:12) [00:22:42.775] at exports.createClient (/vercel/path0/node_modules/next-sanity/dist/next-sanity.cjs.production.min.js:1:1023) [00:22:42.775] at Object.5149 (/vercel/path0/.next/server/pages/index.js:1096:75) [00:22:42.775] at webpack_require (/vercel/path0/.next/server/webpack-runtime.js:25:42) [00:22:42.776] at /vercel/path0/.next/server/pages/index.js:939:66 [00:22:42.776] at Function.webpack_require.a (/vercel/path0/.next/server/webpack-runtime.js:89:13) [00:22:42.776] at Object.5075 (/vercel/path0/.next/server/pages/index.js:920:21) [00:22:42.777] [00:22:42.777] > Build error occurred [00:22:42.780] Error: Failed to collect page data for / [00:22:42.781] at /vercel/path0/node_modules/next/dist/build/utils.js:916:15 [00:22:42.781] at processTicksAndRejections (node:internal/process/task_queues:96:5) { [00:22:42.781] type: 'Error' [00:22:42.782] } [00:22:42.826] error Command failed with exit code 1. [00:22:42.826] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. [00:22:42.854] Error: Command "yarn run build" exited with 1

NirajanMahara commented 1 year ago

I'm godly

For Deployment follow this procedure if you are getting errors...

  1. Run yarn dev in your project folder.
  2. Then run terminal as administrator and cd to your project folder then run vercel build command.
  3. After it finished successfully , delete the folder inside .vercel\output\functions_next\data
  4. Then run vercel deploy prebuilt -> successful (It worked for me)
aymenAbessi commented 1 year ago

I'm godly

For Deployment follow this procedure if you are getting errors...

  1. Run yarn dev in your project folder.
  2. Then run terminal as administrator and cd to your project folder then run vercel build command.
  3. After it finished successfully , delete the folder inside .vercel\output\functions_next\data
  4. Then run vercel deploy prebuilt -> successful (It worked for me)

thanks bro it work

janek commented 1 year ago

I think it's not the same, but in case someone had the same problem as me and ended up here because of path0:

Error message: Error: ENOENT: no such file or directory, open '/vercel/path0/.next/server/pages/index.json' Problem/solution: I had implemented SSG-type authorization on a page without on a page that I didn't mark as SSG. The solution was to add getStaticProps

komfysach commented 1 year ago

Deleting the folder inside 'data' after the unsuccessful build worked for me as well

atifghaffar83 commented 1 year ago

I'm godly For Deployment follow this procedure if you are getting errors...

  1. Run yarn dev in your project folder.
  2. Then run terminal as administrator and cd to your project folder then run vercel build command.
  3. After it finished successfully , delete the folder inside .vercel\output\functions_next\data
  4. Then run vercel deploy prebuilt -> successful (It worked for me)

thanks bro it work

i have done the same thing project is working but also not working when using updating SANITY backend Following the error i am receving ////////////////////////// no such file or directory, stat '/vercel/path0/.vercel/output/functions/_next/data/NUJfM8UYA8u-ImkfxPkqg/index.json.func //////////////////////////

willnogueira2 commented 1 year ago

I did some digging. This has something to do with folders with symbolic links on Windows, for folders mentioned above like the examples inside 'data'. When the CLI tries to read some of the folders it says it's not found because it's probably reading those folders using the wrong API on windows (or whatever language it's written on, nodejs ?) I tested the same commands on Ubuntu for Windows and it works fine.

vercel link --project=$PROJECT_NAME --token=$TOKEN --yes vercel pull --yes --environment=production --token=$TOKEN vercel build --prod --token=$TOKEN vercel deploy --prebuilt --prod --token=$TOKEN

balazsorban44 commented 1 year ago

This issue has been automatically closed because it received no activity for a month and had no reproduction to investigate. If you think it was closed by accident, please leave a comment. If you are running into a similar issue, please open a new issue with a reproduction. Thank you.

AniketUndalekar1997 commented 1 year ago

I'm facing the same Issue, Tried deleting the folder inside data and ran prebuilt cmd, it's worked but vercel is not giving production url istead it asking to run vercel --prod cmd and after running that getting same errors, not able to figure out why. I'm deploying on windows machine, please help to solve this issue. image

entrymaster commented 1 year ago

@NirajanMahara Thanks a lot

Ianpengg commented 1 year ago

Hi there, I just want to shared my solution, I tried to first upload my whole project folder into a github repository, then use import project in the vercel dashboard, after that I just hit deploy and nothing error happened and it just successed deploy. image

image

github-actions[bot] commented 1 year ago

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.