Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Next.js and React

next build stops because of ESLint errors, and next lint is gone

ErrorNeed to disable some ESLint rules

Short answer

In Next.js 15, next build runs ESLint when it is installed and fails on errors. Fix the code, or turn off the single rule in eslint.config.mjs. Skipping the check with ignoreDuringBuilds is the last option. Next.js 16 removed next lint and the eslint option, so run the ESLint CLI yourself.

  • Applies to Next.js 15, Next.js 16, ESLint 9
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Run ESLint on its own. It prints the file, line and rule name of every error, and the rule name is what you either fix or switch off.

    npx eslint .
    npx next --version
  2. 2Match what you see, then jump to its fix

    1. 1next build ends with lint errors, while next dev still runs.A rule reports an error that next build treats as a failure (Next.js 15)Fix
    2. 2ESLint already runs in CI or a pre-commit hook, and the build step repeats the check.You want the build to pass while linting runs elsewhere (Next.js 15)Fix
    3. 3The lint script that called next lint stops working, or the eslint key in next.config is no longer needed.You upgraded to Next.js 16, where next lint was removedFix

What does the error look like?

  • Need to disable some ESLint rules
  • next build fails because ESLint reports errors
  • A lint script that runs next lint no longer works after upgrading to Next.js 16

Cause 1 of 3

A rule reports an error that next build treats as a failure (Next.js 15)

1Check

When ESLint is detected, Next.js 15 fails the production build if errors are present. The rule name printed by ESLint tells you what to change.

npx eslint . --format stylish

2Fix

Fix the code if the rule is right. If the rule does not suit your project, change its level in the ESLint config, one rule at a time.

// eslint.config.mjs
import { defineConfig, globalIgnores } from 'eslint/config'
import nextVitals from 'eslint-config-next/core-web-vitals'

export default defineConfig([
  ...nextVitals,
  {
    rules: {
      'react/no-unescaped-entities': 'off',
    },
  },
  globalIgnores(['.next/**', 'out/**', 'build/**', 'next-env.d.ts']),
])

3Verify

Run the same ESLint command and then the build.

npx eslint .
npx next build

Confirmed by nextjs.org

Did this fix it?

Cause 2 of 3

You want the build to pass while linting runs elsewhere (Next.js 15)

1Check

Check that ESLint really runs in another step, because this setting lets builds succeed even with lint errors.

grep -n "eslint" package.json .github/workflows/*.yml 2>/dev/null

2Fix

Turn off the built-in step with ignoreDuringBuilds. The Next.js 15 docs advise this only when linting happens elsewhere in your workflow.

// next.config.js (Next.js 15)
module.exports = {
  eslint: {
    ignoreDuringBuilds: true,
  },
}

3Verify

Run the build. It completes, and your CI lint job still reports the errors.

npx next build

Confirmed by nextjs.org

Did this fix it?

Cause 3 of 3

You upgraded to Next.js 16, where next lint was removed

1Check

Starting with Next.js 16, next lint is removed. The eslint option in the Next config is no longer needed and can be deleted.

grep -n "next lint" package.json
grep -n "eslint" next.config.*

2Fix

Install ESLint with eslint-config-next, create eslint.config.mjs, point the lint script at the ESLint CLI and delete the eslint option from next.config.

npm i -D eslint eslint-config-next

# package.json
"scripts": { "lint": "eslint ." }

3Verify

Run the new script.

npm run lint

Confirmed by nextjs.org

Did this fix it?

How do I stop it coming back?

  • Run npx eslint . in CI as its own step, so lint errors show up before the build.
  • Change a rule in eslint.config.mjs with a short comment on why, instead of silencing a whole folder.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.