Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Need to disable some ESLint rules" error while make the build of next js app

Tags:

eslint

next.js

I want to deploy my Next.js file on the server. When I hit the command npm run build it shows the error

Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules

I am unable to find the mistake because the app is working properly in localhost but when I want to make the build it shows an error. the packages in my package.json file is

{
  "name": "yourguide-next-frontend",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "node server.js",
    "build": "next build",
    "start": "NODE_ENV=production node server.js"
  },
  "dependencies": {
    "@emotion/react": "^11.10.0",
    "@emotion/server": "^11.10.0",
    "@emotion/styled": "^11.9.3",
    "@mui/material": "^5.10.2",
    "@tinymce/tinymce-react": "^4.2.0",
    "cjs": "^0.0.11",
    "cookies": "^0.8.0",
    "js-cookie": "^3.0.1",
    "next": "12.2.3",
    "react": "18.2.0",
    "react-bootstrap": "^2.4.0",
    "react-dom": "18.2.0",
    "tinymce": "^6.1.2"
  },
  "devDependencies": {
    "@next/eslint-plugin-next": "^12.2.5",
    "eslint": "8.20.0",
    "eslint-config-next": "12.2.3"
  }
}

I don't know the ESLint rules. kindly give me the solution of this problem.

like image 837
MUHAMMAD HARIS Avatar asked Jan 31 '26 09:01

MUHAMMAD HARIS


2 Answers

To ignore eslint during build in nextjs, you have to add this line to the next.config.js file:

eslint: {
    ignoreDuringBuilds: true,
},
like image 117
kamp Avatar answered Feb 03 '26 01:02

kamp


You can ignore eslint by editing your next.config.js file.

Example:

/** @type {import('next').NextConfig} */

const nextConfig = {
    eslint: {
        ignoreDuringBuilds: true,
    },
/* ...Your other config rules */
}

module.exports = nextConfig

This will ignores eslint, if you want to keep the eslint rules try running the build command locally and fix the errors that pop up.

like image 37
Peter Ngugi Avatar answered Feb 03 '26 01:02

Peter Ngugi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!