Next.js on netlify build fail (possibly multi-lang)

Hey there,

Having an issue where my build is claiming there is no index.html in the serverless/pages directory, which is correct. I believe that because of the multi-lang set-up I am running, an index.js is being created instead which swaps between en.html and fr.html.


Error log:
Plugin “@netlify/plugin-nextjs” internal error

Error: ENOENT: no such file or directory, stat '.next/serverless/pages/index.html'

In "onBuild" event in "@netlify/plugin-nextjs" from Netlify app
at Object.statSync (fs.js:933:3)
at Object.statSync (/opt/build/repo/.netlify/plugins/node_modules/graceful-fs/polyfills.js:307:34)
at statSync (/opt/build/repo/.netlify/plugins/node_modules/fs-extra/lib/util/stat.js:10:52)
at getStatsSync (/opt/build/repo/.netlify/plugins/node_modules/fs-extra/lib/util/stat.js:24:19)
at Object.checkPathsSync (/opt/build/repo/.netlify/plugins/node_modules/fs-extra/lib/util/stat.js:49:33)
at copySync (/opt/build/repo/.netlify/plugins/node_modules/fs-extra/lib/copy-sync/copy-sync.js:24:38)
at setupStaticFileForPage (/opt/build/repo/.netlify/plugins/node_modules/next-on-netlify/lib/helpers/setupStaticFileForPage.js:15:3)
at /opt/build/repo/.netlify/plugins/node_modules/next-on-netlify/lib/pages/getStaticProps/setup.js:27:5
at Array.forEach ()
at setup (/opt/build/repo/.netlify/plugins/node_modules/next-on-netlify/lib/pages/getStaticProps/setup.js:22:9)

Error properties:
errno: -2,
syscall: 'stat',
code: 'ENOENT',
path: '.next/serverless/pages/index.html'
1 Like

Hi @rileymacisaac I am encountering the same issue, any chance you solved the issue?

I have a deployment from 29th of January that worked.

I tried to rebuild the same commit yesterday and I get the error message above, maybe something changed in the plugin in this period of time?

Successful deploy: @netlify/plugin-nextjs@1.1.0
Failing deploy: @netlify/plugin-nextjs@2.0.0

Is there a way to specify the plugin version through netlify?

Setting my next version to 10.0.6 in my package.json fixed the issue… I hope this will help you too

This did indeed fix the issue. Thanks @villqrd.