New Jun 7, 2026

Next.js build fails at closing tag

Libraries, Frameworks, etc. All from Newest questions tagged reactjs - Stack Overflow View Next.js build fails at closing tag on stackoverflow.com

I am deploying a Next.js project to Vercel and the build fails during next build. The error points to the closing </Layout> tag in pages/index.js and shows "Expression expected" and "Unterminated regexp literal".

I checked for missing JSX tags, duplicate closing tags, and dependency issues. The component returns JSX inside a Layout component and appears valid. I also removed "use client" since I am using the pages router.

Could someone help identify what syntax issue might cause Vercel to report an error at the closing </Layout> tag even when the JSX looks correct? Is there a way to locate hidden syntax errors elsewhere in the file that could trigger this build failure?

Scroll to top