Builds working locally but failing with netlift

My builds are working locally but once deployed to Netlify it is failing. Here is the log:

11:39:44 AM: Build ready to start
11:39:51 AM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
11:39:51 AM: build-image tag: v4.10.1
11:39:51 AM: buildbot version: f45292fab0b32cea549baa8489f553abb9d888be
11:39:51 AM: Fetching cached dependencies
11:39:51 AM: Failed to fetch cache, continuing with build
11:39:51 AM: Starting to prepare the repo for build
11:39:51 AM: No cached dependencies found. Cloning fresh repo
11:39:51 AM: git clone GitHub - stephangriesel/sandysoil-site
11:39:52 AM: Preparing Git Reference refs/heads/master
11:39:52 AM: Parsing package.json dependencies
11:39:53 AM: Starting build script
11:39:53 AM: Installing dependencies
11:39:53 AM: Python version set to 2.7
11:39:53 AM: Downloading and installing node v16.17.0…
11:39:53 AM: Downloading https://nodejs.org/dist/v16.17.0/node-v16.17.0-linux-x64.tar.xz…
11:39:54 AM: Computing checksum with sha256sum
11:39:54 AM: Checksums matched!
11:39:56 AM: Now using node v16.17.0 (npm v8.15.0)
11:39:56 AM: Started restoring cached build plugins
11:39:56 AM: Finished restoring cached build plugins
11:39:56 AM: Attempting ruby version 2.7.2, read from environment
11:39:57 AM: Using ruby version 2.7.2
11:39:57 AM: Using PHP version 8.0
11:39:57 AM: No npm workspaces detected
11:39:57 AM: Started restoring cached node modules
11:39:57 AM: Finished restoring cached node modules
11:39:57 AM: Installing NPM modules using NPM version 8.15.0
11:39:57 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
11:39:57 AM: npm WARN config location in the cache, and they are managed by
11:39:57 AM: npm WARN config cacache.
11:39:58 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
11:39:58 AM: npm WARN config location in the cache, and they are managed by
11:39:58 AM: npm WARN config cacache.
11:39:58 AM: npm WARN old lockfile
11:39:58 AM: npm WARN old lockfile The package-lock.json file was created with an old version of npm,
11:39:58 AM: npm WARN old lockfile so supplemental metadata must be fetched from the registry.
11:39:58 AM: npm WARN old lockfile
11:39:58 AM: npm WARN old lockfile This is a one-time fix-up, please be patient…
11:39:58 AM: npm WARN old lockfile
11:40:07 AM: npm WARN deprecated source-map-url@0.4.1: See GitHub - lydell/source-map-url: [DEPRECATED] Tools for working with sourceMappingURL comments.
11:40:07 AM: npm WARN deprecated urix@0.1.0: Please see GitHub - lydell/urix: [DEPRECATED] Makes Windows-style paths more unix and URI friendly.
11:40:07 AM: npm WARN deprecated resolve-url@0.2.1: GitHub - lydell/resolve-url: [DEPRECATED] Like Node.js’ `path.resolve`/`url.resolve` for the browser.
11:40:07 AM: npm WARN deprecated source-map-resolve@0.5.3: See GitHub - lydell/source-map-resolve: [DEPRECATED] Resolve the source map and/or sources for a generated file.
11:40:08 AM: npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: Array.prototype.sort() - JavaScript | MDN
11:40:08 AM: npm WARN deprecated source-map-resolve@0.6.0: See GitHub - lydell/source-map-resolve: [DEPRECATED] Resolve the source map and/or sources for a generated file.
11:40:10 AM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
11:40:12 AM: npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (ReDos Vulnerability Regression Visibility Notice Β· Issue #797 Β· debug-js/debug Β· GitHub)
11:40:12 AM: npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (ReDos Vulnerability Regression Visibility Notice Β· Issue #797 Β· debug-js/debug Β· GitHub)
11:40:14 AM: npm WARN deprecated core-js@3.21.1: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
11:40:14 AM: npm WARN deprecated core-js-pure@3.21.1: core-js-pure@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js-pure.
11:40:22 AM: added 1760 packages, and audited 1761 packages in 25s
11:40:22 AM: 206 packages are looking for funding
11:40:22 AM: run npm fund for details
11:40:22 AM: 9 vulnerabilities (8 high, 1 critical)
11:40:22 AM: To address issues that do not require attention, run:
11:40:22 AM: npm audit fix
11:40:22 AM: To address all issues (including breaking changes), run:
11:40:22 AM: npm audit fix --force
11:40:22 AM: Run npm audit for details.
11:40:22 AM: NPM modules installed
11:40:23 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
11:40:23 AM: npm WARN config location in the cache, and they are managed by
11:40:23 AM: npm WARN config cacache.
11:40:23 AM: Started restoring cached go cache
11:40:23 AM: Finished restoring cached go cache
11:40:23 AM: Installing Go version 1.16.5 (requested 1.16.5)
11:40:26 AM: unset GOOS;
11:40:26 AM: unset GOARCH;
11:40:26 AM: export GOROOT=β€˜/opt/buildhome/.gimme/versions/go1.16.5.linux.amd64’;
11:40:26 AM: export PATH=β€œ/opt/buildhome/.gimme/versions/go1.16.5.linux.amd64/bin:${PATH}”;
11:40:26 AM: go version >&2;
11:40:26 AM: export GIMME_ENV=β€œ/opt/buildhome/.gimme/env/go1.16.5.linux.amd64.env”
11:40:26 AM: go version go1.16.5 linux/amd64
11:40:26 AM: Installing missing commands
11:40:26 AM: Verify run directory
11:40:27 AM: ​
11:40:27 AM: ────────────────────────────────────────────────────────────────
11:40:27 AM: Netlify Build
11:40:27 AM: ────────────────────────────────────────────────────────────────
11:40:27 AM: ​
11:40:27 AM: ❯ Version
11:40:27 AM: @netlify/build 27.15.7
11:40:27 AM: ​
11:40:27 AM: ❯ Flags
11:40:27 AM: baseRelDir: true
11:40:27 AM: buildId: 630b37e0a72cff0008b91847
11:40:27 AM: deployId: 630b37e0a72cff0008b91849
11:40:27 AM: ​
11:40:27 AM: ❯ Current directory
11:40:27 AM: /opt/build/repo
11:40:27 AM: ​
11:40:27 AM: ❯ Config file
11:40:27 AM: No config file was defined: using default values.
11:40:27 AM: ​
11:40:27 AM: ❯ Context
11:40:27 AM: production
11:40:27 AM: ​
11:40:27 AM: ────────────────────────────────────────────────────────────────
11:40:27 AM: 1. Build command from Netlify app
11:40:27 AM: ────────────────────────────────────────────────────────────────
11:40:27 AM: ​
11:40:27 AM: $ npm run build
11:40:28 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
11:40:28 AM: npm WARN config location in the cache, and they are managed by
11:40:28 AM: npm WARN config cacache.
11:40:28 AM: > sandysoil.co.za@0.1.0 build
11:40:28 AM: > webpack
11:40:32 AM: assets by status 172 KiB [cached] 3 assets
11:40:32 AM: orphan modules 1.36 MiB [orphan] 36 modules
11:40:32 AM: runtime modules 7.14 KiB 10 modules
11:40:32 AM: cacheable modules 1.52 MiB
11:40:32 AM: modules by path ./node_modules/ 154 KiB 21 modules
11:40:32 AM: modules by path ./src/ 1.37 MiB
11:40:32 AM: modules by path ./src/UI/ 7.32 KiB 10 modules
11:40:32 AM: modules by path ./src/*.css 1.15 KiB ./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/index.css 754 bytes [built] [code generated] ./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/App.css 426 bytes [built] [code generated] ./src/index.js + 36 modules 1.36 MiB [built] [code generated]WARNING in configurationThe β€˜mode’ option has not been set, webpack will fallback to β€˜production’ for this value.Set β€˜mode’ option to β€˜development’ or β€˜production’ to enable defaults for each environment.You can also set it to β€˜none’ to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/ERROR in Error: Child compilation failed: Module not found: Error: Can’t resolve β€˜/opt/build/repo/src/index.html’ in β€˜/o pt/build/repo’ ModuleNotFoundError: Module not found: Error: Can’t resolve β€˜/opt/build/repo/s rc/index.html’ in β€˜/opt/build/repo’ at /opt/build/repo/node_modules/webpack/lib/Compilation.js:2015:28 at /opt/build/repo/node_modules/webpack/lib/NormalModuleFactory.js:798:13 at eval (eval at create (/opt/build/repo/node_modules/tapable/lib/HookCode Factory.js:33:10), :10:1) at /opt/build/repo/node_modules/webpack/lib/NormalModuleFactory.js:270:22 at eval (eval at create (/opt/build/repo/node_modules/tapable/lib/HookCode Factory.js:33:10), :9:1) at /opt/build/repo/node_modules/webpack/lib/NormalModuleFactory.js:434:22 at /opt/build/repo/node_modules/webpack/lib/NormalModuleFactory.js:120:11 at /opt/build/repo/node_modules/webpack/lib/NormalModuleFactory.js:670:25 at /opt/build/repo/node_modules/webpack/lib/NormalModuleFactory.js:855:8 at /opt/build/repo/node_modules/webpack/lib/NormalModuleFactory.js:975:5 - Compilation.js:2015 [repo]/[webpack]/lib/Compilation.js:2015:28 - NormalModuleFactory.js:798 [repo]/[webpack]/lib/NormalModuleFactory.js:798:13 - NormalModuleFactory.js:270 [repo]/[webpack]/lib/NormalModuleFactory.js:270:22 - NormalModuleFactory.js:434 [repo]/[webpack]/lib/NormalModuleFactory.js:434:22 - NormalModuleFactory.js:120 [repo]/[webpack]/lib/NormalModuleFactory.js:120:11 - NormalModuleFactory.js:670 [repo]/[webpack]/lib/NormalModuleFactory.js:670:25 - NormalModuleFactory.js:855 [repo]/[webpack]/lib/NormalModuleFactory.js:855:8 - NormalModuleFactory.js:975 [repo]/[webpack]/lib/NormalModuleFactory.js:975:5 - child-compiler.js:169 [repo]/[html-webpack-plugin]/lib/child-compiler.js:169:18 - Compiler.js:564 [repo]/[webpack]/lib/Compiler.js:564:11 - Compiler.js:1183 [repo]/[webpack]/lib/Compiler.js:1183:17 - Hook.js:18 Hook.CALL_ASYNC_DELEGATE [as _callAsync] [repo]/[tapable]/lib/Hook.js:18:14 - Compiler.js:1179 [repo]/[webpack]/lib/Compiler.js:1179:33 - Compilation.js:2786 finalCallback [repo]/[webpack]/lib/Compilation.js:2786:11 - Compilation.js:3091 [repo]/[webpack]/lib/Compilation.js:3091:11 - Hook.js:18 Hook.CALL_ASYNC_DELEGATE [as _callAsync] [repo]/[tapable]/lib/Hook.js:18:14 1 ERROR in child compilations (Use β€˜stats.children: true’ resp. β€˜β€“stats-children’ for more details)webpack 5.70.0 compiled with 2 errors and 1 warning in 3631 ms​
11:40:32 AM: ────────────────────────────────────────────────────────────────
11:40:32 AM: β€œbuild.command” failed
11:40:32 AM: ────────────────────────────────────────────────────────────────
11:40:32 AM: ​
11:40:32 AM: Error message
11:40:32 AM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
11:40:32 AM: ​
11:40:32 AM: Error location
11:40:32 AM: In Build command from Netlify app:
11:40:32 AM: npm run build
11:40:32 AM: ​
11:40:32 AM: Resolved config
11:40:32 AM: build:
11:40:32 AM: command: npm run build
11:40:32 AM: commandOrigin: ui
11:40:32 AM: publish: /opt/build/repo/build
11:40:32 AM: publishOrigin: ui
11:40:32 AM: Caching artifacts
11:40:32 AM: Started saving node modules
11:40:32 AM: Finished saving node modules
11:40:32 AM: Started saving build plugins
11:40:32 AM: Finished saving build plugins
11:40:32 AM: Started saving pip cache
11:40:32 AM: Finished saving pip cache
11:40:33 AM: Creating deploy upload records
11:40:32 AM: Started saving emacs cask dependencies
11:40:32 AM: Finished saving emacs cask dependencies
11:40:32 AM: Started saving maven dependencies
11:40:32 AM: Finished saving maven dependencies
11:40:33 AM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
11:40:32 AM: Started saving boot dependencies
11:40:32 AM: Finished saving boot dependencies
11:40:32 AM: Started saving rust rustup cache
11:40:32 AM: Finished saving rust rustup cache
11:40:32 AM: Started saving go dependencies
11:40:32 AM: Finished saving go dependencies
11:40:33 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:40:33 AM: Failing build: Failed to build site
11:40:33 AM: Finished processing build request in 42.14219992s

Hey @sgriesel

Appears webpack is looking for an index.html that doesn’t exist.

I cloned the repository locally and received the same error when I ran npm run build.

1 Like