This is from Vercel, but the same error occurs on my machine.
Rolling back to 1.0.0-beta.12 fixes the issue. Astro is on 1.6.10.
π§ͺ Localized .astro pages were generated successfully, it took 8ms!
--
11:15:24.568 | file:///vercel/path0/node_modules/astro-i18next/dist/cli/index.js:351
11:15:24.570 | `+e,vI=(e,i=1)=>(e.startsWith("./")&&(e=e.slice(2)),e.padStart(e.length+i*3,"../")),kU=e=>/((^_)\|(\/_))/.test(e),xI=e=>Kh.default.createSourceFile("x.ts",EU(e),Kh.default.ScriptTarget.Latest),CI=(e,i,u)=>{let _=Kh.default.transform(e,[mI],{locale:i,fileDepth:u});return Kh.default.createPrinter().printNode(Kh.default.EmitHint.Unspecified,_.transformed[0],e)},BC=(e,i=void 0,u=[])=>{let _=new hI.fdir().filter(y=>!kU(y)&&y.endsWith(".astro")).exclude(y=>u.includes(y)).withRelativePaths();return i?_.crawl(`${e}${DI.sep}${i}`).sync():_.crawl(e).sync()},TI=e=>{e.forEach(i=>{yI.default.ensureDirSync(DI.dirname(i.path)),TU.writeFileSync(i.path,i.source)})},EI=(e,i=null,u="",_={})=>{if(e=e.replace(/^\/+\|\/+$/g,""),u=u.replace(/\/+$/g,""),i===null)return`${u}/${e}`;e=e.replace(/.astro$/,"");let y=`/${i}/${e}`;return Object.prototype.hasOwnProperty.call(_,y)?`${u}${_[y]}.astro`:`${u}/${i}/${e}.astro`};var kI=(e,i,u,_=!1,y,m=e)=>{let w=process.hrtime(),q=_?BC(e,i,u):BC(e,void 0,u),x=[];return q.forEach(async function(D){let v=_?[e,i,D].join("/"):[e,D].join("/"),ie=AU.readFileSync(v).toString(),se=xI(ie);u.forEach(pe=>{let g=pe!==i,p=CI(se,pe,_?0:Number(g)),W=SI(ie,p),O=_?!0:g;x.push({path:EI(D,O?pe:void 0,m,y),source:W})})}),TI(x),{filesToGenerate:x,timeToProcess:process.hrtime(w)[1]/1e6}};import{pathToFileURL as PU}from"url";import GV,{t as KV}from"i18next";import{fileURLToPath as AI}from"url";import NI from"@proload/core";import NU from"@proload/plugin-tsm";var PI=async(e,i)=>{let u=AI(e),_;if(i){let y=/^\.*\//.test(i)?i:`./${i}`;_=AI(new URL(y,e))}return NI.use([NU]),await NI("astro-i18next",{mustExist:!1,cwd:u,filePath:_})};var II=async e=>{let{path:i,config:u}=e,_=await PI(PU(i),u);if(i&&!(_!=null&&_.value))throw new Error(`Could not find a config file at ${JSON.stringify(i)}. Does the file exist?`);return{...e,config:_==null?void 0:_.value}},wI=async e=>{let{path:i}=e;return{...e,path:i.endsWith("/")?i:i+"/"}};vN(Bx(process.argv)).usage("usage: $0 <command>").command("generate [path] [options]","generates localized Astro pages",e=>e.positional("path",{type:"string",description:"Path to the Astro project folder",default:"./"}).option("output",{alias:"o",type:"string",description:"Set the output of the generated pages if different from input"}),async e=>{e.verbose&&console.info(`Generating localized pages: ${e.config.locales}`);let i=e.path+"src/pages",u=Nx(e.config.routes),_=kI(i,e.config.defaultLocale,e.config.locales,e.config.showDefaultLocale,u,e.output);if(e.verbose){let y=_.filesToGenerate.map(m=>m.path);console.log(`
11:15:24.571 | Β
11:15:24.571 | TypeError: Cannot read properties of undefined (reading 'forEach')
11:15:24.571 | at file:///vercel/path0/node_modules/astro-i18next/dist/cli/index.js:351:1111
11:15:24.572 | at Array.forEach (<anonymous>)
11:15:24.572 | at kI (file:///vercel/path0/node_modules/astro-i18next/dist/cli/index.js:351:998)
11:15:24.572 | at Object.handler (file:///vercel/path0/node_modules/astro-i18next/dist/cli/index.js:351:2411)
11:15:24.572 | at file:///vercel/path0/node_modules/astro-i18next/dist/cli/index.js:285:27978
11:15:24.572 | at Nv (file:///vercel/path0/node_modules/astro-i18next/dist/cli/index.js:285:24124)
11:15:24.572 | at zx.handleValidationAndGetResult (file:///vercel/path0/node_modules/astro-i18next/dist/cli/index.js:285:27960)
11:15:24.572 | at file:///vercel/path0/node_modules/astro-i18next/dist/cli/index.js:285:28532
11:15:24.592 | Error: Command "npx astro-i18next generate && npm run build" exited with 1