Failed to compile: ESLint errors during next build Next.js Origin: On your device OSI layer 7 · Application Last updated 5 Nov 2026

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.

Exact message you may see 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
Seen on: Next.js TypeScript

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)
  • any types with strict rules
  • Hooks dependency rules

⚡ Quick fix

  1. Fix the listed lint errors (file:line shown)
  2. Adjust rules in .eslintrc.json if too strict
  3. eslint: { ignoreDuringBuilds: true } only as a temporary escape

Detailed fix by platform

Next.js

  1. npx next lint --fix fixes auto-fixable issues

How to diagnose

  1. Rule — Which ESLint rule?
  2. Fix — Auto-fixable?
  3. 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:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

[Vue warn]: Component is missing template or render function — Vue: [Vue warn]: Component is missing template or render function. (Vue)[Vue warn]: Component…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 (Next.js)Could not find a prod…ELIFECYCLE — npm ERR! code ELIFECYCLE / Command failed with exit code 1 (npm)ELIFECYCLEERR_OSSL_EVP_UNSUPPORTED — Error: error:0308010C:digital envelope routines::unsupported (Node.js)ERR_OSSL_EVP_UNSUPPOR…ESLint Parsing error in .vue files — ESLint: Parsing error: Unexpected token < / Parsing error: '>' expected (vue-eslint-parser not configured) (Vue)ESLint Parsing error …Failed to fetch font from Google Fonts — Next.js: ⨯ Failed to download `Inter` from Google Fonts. Using fallback font instead / FetchError: request to https://fonts.googleapis.com failed (Next.js)Failed to fetch font …gyp ERR! — gyp ERR! build error / node-gyp rebuild failed (npm)gyp ERR!Module not found: Can't resolve 'x' (Next.js build) — Next.js: Module not found: Can't resolve '@/components/Button' / 'lodash' in '/app/src' (Next.js)Module not found: Can…Failed to…

Explore the map of this error Full error map →

🧠 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.