Next.js: Failed to compile. ./src/app/page.tsx 12:7 Error: 'x' is assigned a value but never used. @typescript-eslint/no-unused-vars
next build runs ESLint and fails the build on lint errors.
Failed to compile. ./src/app/page.tsx Error: 'x' is assigned a value but never used. @typescript-eslint/no-unused-varsLinting and checking validity of types ... Failed to compilereact/no-unescaped-entities `'` can be escaped with `'`Error: Unexpected any. Specify a different type. @typescript-eslint/no-explicit-anyFailed to compile. ESLint Meaning
Fix the reported lint errors, or relax the rules in .eslintrc. To temporarily skip (not recommended) set eslint: { ignoreDuringBuilds: true } in next.config.js (Next ≤15) and fix lint in CI separately. Common ones: unused vars, react/no-unescaped-entities, @next/next/no-img-element, react-hooks/exhaustive-deps (warning).
Common causes
- Unused variables/imports
- Unescaped quotes in JSX
<img>instead of<Image>(warning)anytypes with strict rules- Hooks dependency rules
⚡ Quick fix
- Fix the listed lint errors (file:line shown)
- Adjust rules in
.eslintrc.jsonif too strict eslint: { ignoreDuringBuilds: true }only as a temporary escape
Detailed fix by platform
Next.js
npx next lint --fixfixes auto-fixable issues
How to diagnose
- Rule — Which ESLint rule?
- Fix — Auto-fixable?
- Policy — Lint in CI?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- [Vue warn]: Component is missing template or render function Vue: [Vue warn]: Component is missing template or render function.
- Could not find a production build in the '.next' directory Next.js: Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server
- ELIFECYCLE npm ERR! code ELIFECYCLE / Command failed with exit code 1
Most viewed in Next.js
- NEXT_REDIRECT Next.js: Error: NEXT_REDIRECT (redirect() inside try/catch)
- server-only Next.js: You're importing a component that needs "server-only". That only works in a Server Component
- cookies() should be awaited Next.js 15: Route "/x" used `cookies().get('token')`. `cookies()` should be awaited before using its value
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026