vercel / next.js

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

Error: ENOENT: no such file or directory, open '/vercel/path0/.next/server/pages/404.html' #53502

Open customer-tfp opened 1 year ago

customer-tfp commented 1 year ago

Verify canary release

Provide environment information

Node 16 - 18
React 17
Next 12.2

"dependencies": {
    "@apollo/client": "^3.4.13",
    "@emotion/react": "^11.10.5",
    "@next/bundle-analyzer": "^13.1.1",
    "@react-oauth/google": "^0.7.0",
    "@stripe/react-stripe-js": "^1.0.0",
    "@stripe/stripe-js": "^1.0.0",
    "axios": "^0.21.4",
    "dayjs": "^1.11.5",
    "dotenv": "^14.2.0",
    "final-form": "^4.20.7",
    "formik": "^2.2.9",
    "fs": "0.0.1-security",
    "imagekitio-react": "^2.0.0",
    "moment": "^2.29.4",
    "next": "^12.2.5",
    "next-i18next": "^12.0.0",
    "next-redux-wrapper": "^7.0.5",
    "next-sitemap": "^2.5.20",
    "node-fetch": "^3.2.3",
    "nprogress": "^0.2.0",
    "prop-types": "^15.8.1",
    "qs": "^6.11.0",
    "react": "17.0.2",
    "react-aria": "^3.21.0",
    "react-awesome-reveal": "^4.0.1",
    "react-dom": "17.0.2",
    "react-final-form": "^6.5.9",
    "react-icons": "^4.2.0",
    "react-infinite-scroll-component": "^6.1.0",
    "react-inner-image-zoom": "^3.0.0",
    "react-lazyload": "^3.2.0",
    "react-loading-overlay": "^1.0.1",
    "react-map-gl": "^6.1.17",
    "react-markdown": "^8.0.3",
    "react-moment": "^1.1.2",
    "react-multi-carousel": "^2.6.5",
    "react-places-autocomplete": "^7.3.0",
    "react-redux": "^7.1.0",
    "react-share": "^4.4.1",
    "react-simple-tooltip": "^2.6.3",
    "react-slick": "^0.28.1",
    "react-speech-recognition": "^3.9.0",
    "react-swipeable-views": "^0.14.0",
    "redux": "^4.1.1",
    "redux-devtools-extension": "^2.13.2",
    "redux-saga": "^1.1.3",
    "redux-thunk": "^2.4.0",
    "remark-gfm": "^3.0.1",
    "shortid": "^2.2.16",
    "slick-carousel": "^1.8.1",
    "styled-components": "latest",
    "swr": "^1.2.2",
    "yup": "^0.32.9"
  },
  "devDependencies": {
    "autoprefixer": "^10.4.0",
    "eslint": "7.29.0",
    "eslint-config-next": "11.0.1",
    "file-loader": "^6.2.0",
    "googleapis": "^107.0.0",
    "lodash": "^4.17.21",
    "postcss": "^8.4.5",
    "react-datepicker": "^4.5.0",
    "sitemap": "^7.1.1",
    "tailwindcss": "^3.0.7"
  }

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

Can't link the project but I can shared package.json

To Reproduce

Custom 404.js added Node 16 and 18 used both gives the same error React 17 Next 12.2

Describe the Bug

This bug happens at the end of the build process during deployment on vercel, projects build but deployment fails due to 404.html not found error

Expected Behavior

I did not change anything important on package.json or next-config.js or vercel project settings but recently this error started to occur on my projects that has 404.js as a custom 404 page.

Which browser are you using? (if relevant)

any

How are you deploying your application? (if relevant)

Vercel

rishab85 commented 1 year ago

We are also having similar issue and as a quick fix we just removed notFound from our getStaticProps. It seems to break when we have that props returned from getStaticProps. Hope to get actual fix soon since we we notFound extensively in our applications.

joshmu commented 1 year ago

We are also experiencing this issue on our production servers which are preventing builds.
Same error response after build completes: Error: ENOENT: no such file or directory, open '/vercel/path0/.next/server/pages/404.html

We were able to remove the usage of notFound in our getStaticProps and that worked!

However our other nextjs instances use the notFound attribute a lot and so we are blocked

chozzz commented 1 year ago

Same thing happened to me;

Looks like issue starts to happen with Vercel CLI 31.2.1 image

Also, I noticed the issue wasn't there back in Vercel CLI 31.0.4 - Not sure if its related to i18n + 404 page PR#10243?

Update: The issue was reproducible locally with both Vercel CLI versions above and Removing notFound from getStaticProps fixes the issue as per @joshmu mentioned above worked.

luskafaria commented 1 year ago

I'm facing the same issue. For now, I just stopped using the 404 page as a fallback but that's not a fix. Does anyone have an alternative solution/fix/workaround?

maximeperrault commented 1 year ago

Same problem here. I use standalone output with app router, I don't have /pages directory. when I run npm run build it returns the following `○ / 2.17 kB 173 kB ├ ○ /_not-found 0 B 0 B ├ ○ /infos 1.73 kB 95.9 kB └ λ /picture/[link] 666 B 101 kB

Route (pages) Size First Load JS ─ ○ /404 182 B 76.5 kB

RealGatt commented 1 year ago

Can also replicate on 13.4.20-canary.10. Started occuring after 13.4.20-canary.3. I have all my error pages in an (errorpages) folder within the app router. Deleting them is the only way around it for me currently.

image