Building error exit code 2

I have a building error and I don’t know from where it comes. I think it has to to with node & the dependencies. I think I upgraded gatsby and from there I can’t get out of the building error.

Netlify site name: modest-shaw-b1253a.netlify.app

I got another netlify site which also doesn’t build anymore and gives same errors, so I did something wrong with npm, node, or the peer dependencies.

Thanks

 2:16:37 PM: Build ready to start
2:16:39 PM: build-image version: 7b53c5fc4445e3ec99d3949e5d1174a8c5be4f16
2:16:39 PM: build-image tag: v3.7.2
2:16:39 PM: buildbot version: ad3775146a808b8ede7bd671caa29eb30319802f
2:16:39 PM: Building without cache
2:16:39 PM: Starting to prepare the repo for build
2:16:39 PM: No cached dependencies found. Cloning fresh repo
2:16:39 PM: git clone https://github.com/victorlaforga/laforga-agency-soon
2:16:41 PM: Preparing Git Reference refs/heads/main
2:16:41 PM: Parsing package.json dependencies
2:16:43 PM: Starting build script
2:16:43 PM: Installing dependencies
2:16:43 PM: Python version set to 2.7
2:16:44 PM: Downloading and installing node v16.0.0...
2:16:44 PM: Downloading https://nodejs.org/dist/v16.0.0/node-v16.0.0-linux-x64.tar.xz...
2:16:45 PM: Computing checksum with sha256sum
2:16:45 PM: Checksums matched!
2:16:48 PM: Now using node v16.0.0 (npm v7.10.0)
2:16:48 PM: Started restoring cached build plugins
2:16:48 PM: Finished restoring cached build plugins
2:16:48 PM: Attempting ruby version 2.7.1, read from environment
2:16:50 PM: Using ruby version 2.7.1
2:16:50 PM: Using PHP version 5.6
2:16:50 PM: Started restoring cached node modules
2:16:50 PM: Finished restoring cached node modules
2:16:50 PM: Installing NPM modules using NPM version 7.10.0
2:17:08 PM: npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
2:17:08 PM: npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
2:17:11 PM: npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
2:17:27 PM: npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
2:17:27 PM: npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
2:17:28 PM: npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
2:17:28 PM: npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
2:17:29 PM: npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
2:17:33 PM: npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
2:17:39 PM: added 2587 packages, and audited 2588 packages in 49s
2:17:39 PM: 221 packages are looking for funding
2:17:39 PM:   run `npm fund` for details
2:17:39 PM: found 0 vulnerabilities
2:17:39 PM: NPM modules installed
2:17:40 PM: Started restoring cached go cache
2:17:40 PM: Finished restoring cached go cache
2:17:40 PM: go version go1.14.4 linux/amd64
2:17:40 PM: go version go1.14.4 linux/amd64
2:17:40 PM: Installing missing commands
2:17:40 PM: Verify run directory
2:17:42 PM: ​
2:17:42 PM: ────────────────────────────────────────────────────────────────
2:17:42 PM:   Netlify Build                                                 
2:17:42 PM: ────────────────────────────────────────────────────────────────
2:17:42 PM: ​
2:17:42 PM: ❯ Version
2:17:42 PM:   @netlify/build 11.4.2
2:17:42 PM: ​
2:17:42 PM: ❯ Flags
2:17:42 PM:   deployId: 608bf5250c3f3d00bbf1c8fc
2:17:42 PM: ​
2:17:42 PM: ❯ Current directory
2:17:42 PM:   /opt/build/repo
2:17:42 PM: ​
2:17:42 PM: ❯ Config file
2:17:42 PM:   No config file was defined: using default values.
2:17:42 PM: ​
2:17:42 PM: ❯ Context
2:17:42 PM:   production
2:17:42 PM: ​
2:17:42 PM: ────────────────────────────────────────────────────────────────
2:17:42 PM:   1. Build command from Netlify app                             
2:17:42 PM: ────────────────────────────────────────────────────────────────
2:17:42 PM: ​
2:17:42 PM: $ npm run build
2:17:42 PM: > laforga-soon@1.0.0 build
2:17:42 PM: > gatsby build
2:17:46 PM: success open and validate gatsby-configs - 0.020s
2:17:47 PM: success load plugins - 0.793s
2:17:47 PM: success onPreInit - 0.054s
2:17:47 PM: success initialize cache - 0.008s
2:17:47 PM: success copy gatsby files - 0.084s
2:17:47 PM: success onPreBootstrap - 0.015s
2:17:47 PM: success createSchemaCustomization - 0.006s
2:17:47 PM: success Checking for changed pages - 0.000s
2:17:47 PM: success source and transform nodes - 0.102s
2:17:47 PM: success building schema - 0.557s
2:17:47 PM: success createPages - 0.009s
2:17:48 PM: success createPagesStatefully - 0.060s
2:17:48 PM: info Total nodes: 42, SitePage nodes: 5 (use --verbose for breakdown)
2:17:48 PM: success Checking for changed pages - 0.000s
2:17:48 PM: success update schema - 0.094s
2:17:48 PM: success onPreExtractQueries - 0.001s
2:17:48 PM: success extract queries from components - 0.624s
2:17:48 PM: success write out redirect data - 0.003s
2:17:48 PM: success onPostBootstrap - 0.002s
2:17:48 PM: info bootstrap finished - 6.165s
2:17:48 PM: success run page queries - 0.017s - 4/4 237.60/s
2:17:48 PM: success write out requires - 0.006s
2:18:11 PM: failed Building production JavaScript and CSS bundles - 22.324s
2:18:11 PM: error Generating JavaScript bundles failed
2:18:11 PM: Module build failed (from ./node_modules/css-loader/dist/cjs.js):
2:18:11 PM: Error: Can't resolve '../assets/fonts/BebasNeue/OTf/BebasNeue-Light.otf' in '/opt/build/repo/src/styles'    at finishWithoutResolve (/opt/build/repo/node_modules/enhanced-resolve/lib/Resolver.js:293:18)
2:18:11 PM:     at /opt/build/repo/node_modules/enhanced-resolve/lib/Resolver.js:362:15
2:18:11 PM:     at /opt/build/repo/node_modules/enhanced-resolve/lib/Resolver.js:410:5
2:18:11 PM:     at eval (eval at create (/opt/build/repo/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
2:18:11 PM:     at /opt/build/repo/node_modules/enhanced-resolve/lib/Resolver.js:410:5
2:18:11 PM:     at eval (eval at create (/opt/build/repo/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
2:18:11 PM:     at /opt/build/repo/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:87:43
2:18:11 PM:     at /opt/build/repo/node_modules/enhanced-resolve/lib/Resolver.js:410:5
2:18:11 PM:     at eval (eval at create (/opt/build/repo/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
2:18:11 PM:     at /opt/build/repo/node_modules/enhanced-resolve/lib/Resolver.js:410:5
2:18:11 PM:     at eval (eval at create (/opt/build/repo/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
2:18:11 PM:     at /opt/build/repo/node_modules/enhanced-resolve/lib/Resolver.js:410:5
2:18:11 PM:     at eval (eval at create (/opt/build/repo/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:28:1)
2:18:11 PM:     at /opt/build/repo/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:87:43
2:18:11 PM:     at /opt/build/repo/node_modules/enhanced-resolve/lib/Resolver.js:410:5
2:18:11 PM:     at eval (eval at create (/opt/build/repo/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
2:18:11 PM: ​
2:18:11 PM: ────────────────────────────────────────────────────────────────
2:18:11 PM:   "build.command" failed                                        
2:18:11 PM: ────────────────────────────────────────────────────────────────
2:18:11 PM: ​
2:18:11 PM:   Error message
2:18:11 PM:   Command failed with exit code 1: npm run build
2:18:11 PM: ​
2:18:11 PM:   Error location
2:18:11 PM:   In Build command from Netlify app:
2:18:11 PM:   npm run build
2:18:11 PM: ​
2:18:11 PM:   Resolved config
2:18:11 PM:   build:
2:18:11 PM:     command: npm run build
2:18:11 PM:     commandOrigin: ui
2:18:11 PM:     environment:
2:18:11 PM:       - NODE_VERSION
2:18:11 PM:     publish: /opt/build/repo/public
2:18:11 PM: Caching artifacts
2:18:11 PM: Started saving node modules
2:18:11 PM: Finished saving node modules
2:18:11 PM: Started saving build plugins
2:18:11 PM: Finished saving build plugins
2:18:11 PM: Started saving pip cache
2:18:11 PM: Finished saving pip cache
2:18:11 PM: Started saving emacs cask dependencies
2:18:11 PM: Finished saving emacs cask dependencies
2:18:11 PM: Started saving maven dependencies
2:18:11 PM: Finished saving maven dependencies
2:18:11 PM: Started saving boot dependencies
2:18:11 PM: Finished saving boot dependencies
2:18:11 PM: Started saving rust rustup cache
2:18:11 PM: Finished saving rust rustup cache
2:18:11 PM: Started saving go dependencies
2:18:11 PM: Finished saving go dependencies
2:18:15 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
2:18:15 PM: Creating deploy upload records
2:18:16 PM: Failing build: Failed to build site
2:18:16 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
2:18:16 PM: Finished processing build request in 1m37.07052437s

aerial-access-new.netlify.app

Seems like your font file is missing, or you have used the wrong case in file name. The case of file name and import statement should be exactly the same.

2 Likes

@victorlaforga You must have fixed whatever was wrong because each of these sites seems to load fine for me in Southern California, with the exception of the missing favicon.ico files.

1 Like

Thanks man! I just looked over it, appreciate your help!

Yes indeed! Thanks for the effort though! Appreciate it

1 Like