Npm build failed. esLint conflicts

PLEASE help us help you by writing a good post!

  • we need to know your netlify site name. Example: gifted-antelope-58b104.netlify.app
  • DNS issues? Tell us the custom domain, tell us the error message! We can’t help if we don’t know your domain.
  • Build problems? Link or paste the FULL build log & build settings screenshot

The better the post - the faster the answer.

Hey there and thank you for your time,
so I have my repository on gitHub with a netlify hosting and automatic deployment.

When I made a major update to my page I noticed that the web was not being published and only te old version was available.
So I went to check the logs and there I found a npm build error due to some esLint conflicts that I resolved when merging branches on gitHub.

The page is: deepcodecmd.netlify.app

Here is the log of the last one:

5:23:54 PM: Build ready to start
5:23:56 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
5:23:56 PM: build-image tag: v4.8.0
5:23:56 PM: buildbot version: 17f6c1ab2fe6d61574ce02b038041b816bf6c085
5:23:56 PM: Fetching cached dependencies
5:23:56 PM: Starting to download cache of 171.5MB
5:23:59 PM: Finished downloading cache in 2.325205987s
5:23:59 PM: Starting to extract cache
5:24:04 PM: Finished extracting cache in 5.203378827s
5:24:04 PM: Finished fetching cache in 7.54925618s
5:24:04 PM: Starting to prepare the repo for build
5:24:04 PM: Preparing Git Reference refs/heads/main
5:24:05 PM: Parsing package.json dependencies
5:24:06 PM: 
​
❯ Initial build environment
baseRelDir: true
branch: main
context: production
cwd: /opt/build/repo
featureFlags: []
mode: buildbot
repositoryRoot: /opt/build/repo
siteId: 21c2b4f8-bb17-493e-9272-173ae5cbcb5e
​
❯ UI build settings
baseRelDir: true
build:
  command: npm run build
  environment:
    - NETLIFY_BUILD_DEBUG
  publish: build
​
❯ Resolved build environment
branch: main
buildDir: /opt/build/repo
context: production
env: []
​
❯ Resolved config
build:
  command: npm run build
  commandOrigin: ui
  environment:
    - NETLIFY_BUILD_DEBUG
  publish: /opt/build/repo/build
  publishOrigin: ui

5:24:06 PM: Starting build script
5:24:06 PM: Installing dependencies
5:24:06 PM: Python version set to 2.7
5:24:06 PM: Started restoring cached node version
5:24:07 PM: Finished restoring cached node version
5:24:08 PM: v16.15.0 is already installed.
5:24:08 PM: Now using node v16.15.0 (npm v8.5.5)
5:24:08 PM: Started restoring cached build plugins
5:24:08 PM: Finished restoring cached build plugins
5:24:08 PM: Attempting ruby version 2.7.2, read from environment
5:24:09 PM: Using ruby version 2.7.2
5:24:10 PM: Using PHP version 8.0
5:24:10 PM: No npm workspaces detected
5:24:10 PM: Started restoring cached node modules
5:24:10 PM: Finished restoring cached node modules
5:24:10 PM: Installing NPM modules using NPM version 8.5.5
5:24:14 PM: added 1 package, and audited 1414 packages in 3s
5:24:14 PM: 174 packages are looking for funding
5:24:14 PM:   run `npm fund` for details
5:24:14 PM: 10 vulnerabilities (7 moderate, 3 high)
5:24:14 PM: To address issues that do not require attention, run:
5:24:14 PM:   npm audit fix
5:24:14 PM: To address all issues (including breaking changes), run:
5:24:14 PM:   npm audit fix --force
5:24:14 PM: Run `npm audit` for details.
5:24:14 PM: NPM modules installed
5:24:15 PM: Started restoring cached go cache
5:24:15 PM: Finished restoring cached go cache
5:24:15 PM: go version go1.16.5 linux/amd64
5:24:15 PM: go version go1.16.5 linux/amd64
5:24:15 PM: Installing missing commands
5:24:15 PM: Verify run directory
5:24:16 PM: ​
5:24:16 PM: ────────────────────────────────────────────────────────────────
5:24:16 PM:   Netlify Build                                                 
5:24:16 PM: ────────────────────────────────────────────────────────────────
5:24:16 PM: ​
5:24:16 PM: ❯ Version
5:24:16 PM:   @netlify/build 27.1.3
5:24:16 PM: ​
5:24:16 PM: ❯ Flags
5:24:16 PM:   apiHost: api.netlify.com
5:24:16 PM:   baseRelDir: true
5:24:16 PM:   branch: main
5:24:16 PM:   buildId: 6287b28aebed301c3a98ec7b
5:24:16 PM:   buildbotServerSocket: /tmp/netlify-buildbot-socket
5:24:16 PM:   cacheDir: /opt/build/cache
5:24:16 PM:   cachedConfigPath: /tmp/netlify_config.json
5:24:16 PM:   context: production
5:24:16 PM:   cwd: /opt/build/repo
5:24:16 PM:   deployId: 6287b28aebed301c3a98ec7d
5:24:16 PM:   edgeFunctionsDistDir: /tmp/edge-6287b28aebed301c3a98ec7d
5:24:16 PM:   featureFlags:
5:24:16 PM:     - buildbot_build_go_functions
5:24:16 PM:     - edge_functions_cache_cli
5:24:16 PM:     - zisi_parse_isc
5:24:16 PM:   framework: create-react-app
5:24:16 PM:   functionsDistDir: /tmp/zisi-6287b28aebed301c3a98ec7d
5:24:16 PM:   mode: buildbot
5:24:16 PM:   nodePath: /opt/buildhome/.nvm/versions/node/v16.15.0/bin/node
5:24:16 PM:   repositoryRoot: /opt/build/repo
5:24:16 PM:   saveConfig: true
5:24:16 PM:   sendStatus: true
5:24:16 PM:   siteId: 21c2b4f8-bb17-493e-9272-173ae5cbcb5e
5:24:16 PM:   statsd:
5:24:16 PM:     host: 10.65.94.117
5:24:16 PM:     port: 8125
5:24:16 PM:   testOpts:
5:24:16 PM:     silentLingeringProcesses: ''
5:24:16 PM: ​
5:24:16 PM: ❯ Current directory
5:24:16 PM:   /opt/build/repo
5:24:16 PM: ​
5:24:16 PM: ❯ Config file
5:24:16 PM:   No config file was defined: using default values.
5:24:16 PM: ​
5:24:16 PM: ❯ Resolved config
5:24:16 PM:   build:
5:24:16 PM:     command: npm run build
5:24:16 PM:     commandOrigin: ui
5:24:16 PM:     environment:
5:24:16 PM:       - NETLIFY_BUILD_DEBUG
5:24:16 PM:     publish: /opt/build/repo/build
5:24:16 PM:     publishOrigin: ui
5:24:16 PM: ​
5:24:16 PM: ❯ Context
5:24:16 PM:   production
5:24:16 PM: ​
5:24:16 PM: ────────────────────────────────────────────────────────────────
5:24:16 PM:   1. Build command from Netlify app                             
5:24:16 PM: ────────────────────────────────────────────────────────────────
5:24:16 PM: ​
5:24:16 PM: $ npm run build
5:24:16 PM: > frontend@0.1.0 build
5:24:16 PM: > react-scripts build
5:24:18 PM: Creating an optimized production build...
5:24:32 PM: Failed to compile.
5:24:32 PM: 
5:24:32 PM: src/Components/templates/About/About.jsx
5:24:32 PM:   Line 7:1:     Delete `⏎`                                                                                                                                                          prettier/prettier
5:24:32 PM:   Line 102:1:   Replace `⏎··········some·advice·and/or·emotional·support...why?·<br·/>·well,{'·'}⏎` with `··········some·advice·and/or·emotional·support...why?·<br·/>·well,{'·'}`  prettier/prettier
5:24:32 PM:   Line 111:12:  Delete `⏎`                                                                                                                                                          prettier/prettier
5:24:32 PM:   Line 120:1:   Delete `⏎`                                                                                                                                                          prettier/prettier
5:24:32 PM:   Line 134:1:   Delete `⏎`                                                                                                                                                          prettier/prettier
5:24:32 PM:   Line 139:15:  Delete `⏎`                                                                                                                                                          prettier/prettier
5:24:32 PM: src/Components/templates/Experience/Experience.jsx
5:24:32 PM:   Line 28:1:    Delete `⏎`                                            prettier/prettier
5:24:32 PM:   Line 154:1:   Insert `··`                                           prettier/prettier
5:24:32 PM:   Line 154:7:   'Container' is assigned a value but never used        no-unused-vars
5:24:32 PM:   Line 155:3:   Insert `··`                                           prettier/prettier
5:24:32 PM:   Line 156:1:   Replace `··` with `····`                              prettier/prettier
5:24:32 PM:   Line 157:1:   Insert `··`                                           prettier/prettier
5:24:32 PM:   Line 158:1:   Replace `··` with `····`                              prettier/prettier
5:24:32 PM:   Line 159:1:   Insert `··`                                           prettier/prettier
5:24:32 PM: Creating deploy upload records
5:24:32 PM:   Line 161:1:   Insert `··`                                           prettier/prettier
5:24:32 PM:   Line 161:7:   'linkWithImgInfo' is assigned a value but never used  no-unused-vars
5:24:32 PM:   Line 162:1:   Insert `··`                                           prettier/prettier
5:24:32 PM:   Line 163:1:   Replace `··` with `····`                              prettier/prettier
5:24:32 PM:   Line 163:11:  'NSx512' is not defined                               no-undef
5:24:32 PM:   Line 164:1:   Insert `··`                                           prettier/prettier
5:24:33 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
5:24:32 PM:   Line 165:1:   Replace `··` with `····`                              prettier/prettier
5:24:32 PM:   Line 166:1:   Insert `··`                                           prettier/prettier
5:24:32 PM:   Line 167:3:   Insert `··`                                           prettier/prettier
5:24:32 PM:   Line 168:1:   Insert `··`                                           prettier/prettier
5:24:32 PM:   Line 169:1:   Insert `··`                                           prettier/prettier
5:24:32 PM:   Line 170:1:   Replace `};⏎` with `··};`                             prettier/prettier
5:24:32 PM: Search for the keywords to learn more about each error.
5:24:32 PM: ​
5:24:32 PM: ────────────────────────────────────────────────────────────────
5:24:32 PM:   "build.command" failed                                        
5:24:32 PM: ────────────────────────────────────────────────────────────────
5:24:32 PM: ​
5:24:32 PM:   Error message
5:24:32 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
5:24:32 PM: ​
5:24:32 PM:   Error location
5:24:32 PM:   In Build command from Netlify app:
5:24:32 PM:   npm run build
5:24:32 PM: ​
5:24:32 PM:   Resolved config
5:24:32 PM:   build:
5:24:32 PM:     command: npm run build
5:24:32 PM:     commandOrigin: ui
5:24:32 PM:     environment:
5:24:32 PM:       - NETLIFY_BUILD_DEBUG
5:24:32 PM:     publish: /opt/build/repo/build
5:24:32 PM:     publishOrigin: ui
5:24:32 PM: Caching artifacts
5:24:32 PM: Started saving node modules
5:24:32 PM: Finished saving node modules
5:24:32 PM: Started saving build plugins
5:24:32 PM: Finished saving build plugins
5:24:32 PM: Started saving pip cache
5:24:32 PM: Finished saving pip cache
5:24:32 PM: Started saving emacs cask dependencies
5:24:32 PM: Finished saving emacs cask dependencies
5:24:32 PM: Started saving maven dependencies
5:24:32 PM: Finished saving maven dependencies
5:24:32 PM: Started saving boot dependencies
5:24:32 PM: Finished saving boot dependencies
5:24:32 PM: Started saving rust rustup cache
5:24:32 PM: Finished saving rust rustup cache
5:24:32 PM: Started saving go dependencies
5:24:32 PM: Finished saving go dependencies
5:24:32 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:24:33 PM: Failing build: Failed to build site
5:24:33 PM: Finished processing build request in 36.822868239s

Thank you in advance
Kod

Hey @kodamok

I would suggested removing the requirement for prettier when running a build and only use it when developing locally—there is no need for it when building IMHO.

Alternatively, try setting CI=false as part of the build command to ignore the errors.

Hi coelmay,
thank you for your answer.
My prettier is in my devDependecies so it should run fine for only local development as far as I understand.
If not then I miss this bit of information :smiley: could you be more specific as how else can I ignore esLint if is not the devDependecies option?
Thak you!

As mentioned in this documentation

If you set the NODE_ENV to production , any devDependencies in your package.json file will not be installed for the build.

If NODE_ENV is not set to production, devDependencies still load.

Thank you very much!
Send you my best wishes for the rest of your day :smiley: