Netlify build failed unexpectedly

Hi,
we are trying to deploy a build that has failed unexpectedly, even though the same build was deployed successfully 09/06/23 with the same commit SHA: 9716f3971701eda6559a0756fa0773d793c7826f

link site: https://malmo-staging.netlify.app/
link build: Netlify App

could someone help me please?

@Moku Can you make the build log public, or copy and paste its contents within a code block here on the forum?

12:54:34 PM: build-image version: 3b96229e32b19cdf63f20dc1fc9331cd240c2d01 (focal)
12:54:34 PM: buildbot version: 3b96229e32b19cdf63f20dc1fc9331cd240c2d01
12:54:34 PM: Building without cache
12:54:34 PM: Starting to prepare the repo for build
12:54:35 PM: No cached dependencies found. Cloning fresh repo
12:54:35 PM: git clone --filter=blob:none git@bitbucket.org:moku_team/malmo-landing-angular
12:55:27 PM: Preparing Git Reference refs/heads/staging
12:55:29 PM: Starting to install dependencies
12:55:29 PM: Python version set to 3.8
12:55:29 PM: Attempting Ruby version 2.7.2, read from environment
12:55:30 PM: Using Ruby version 2.7.2
12:55:30 PM: Started restoring cached go cache
12:55:30 PM: Finished restoring cached go cache
12:55:30 PM: go version go1.19.10 linux/amd64
12:55:31 PM: Using PHP version 8.0
12:55:32 PM: Attempting Node.js version 'v14.21.2' from .nvmrc
12:55:32 PM: Downloading and installing node v14.21.2...
12:55:32 PM: Downloading https://nodejs.org/dist/v14.21.2/node-v14.21.2-linux-x64.tar.xz...
12:55:32 PM: Computing checksum with sha256sum
12:55:33 PM: Checksums matched!
12:55:35 PM: Now using node v14.21.2 (npm v6.14.17)
12:55:35 PM: Enabling Node.js Corepack
12:55:35 PM: Started restoring cached build plugins
12:55:35 PM: Finished restoring cached build plugins
12:55:35 PM: Started restoring cached corepack dependencies
12:55:35 PM: Finished restoring cached corepack dependencies
12:55:35 PM: Started restoring cached yarn cache
12:55:35 PM: Finished restoring cached yarn cache
12:55:35 PM: No yarn workspaces detected
12:55:35 PM: Started restoring cached node modules
12:55:35 PM: Finished restoring cached node modules
12:55:35 PM: Installing npm packages using Yarn version 1.22.19
12:55:36 PM: yarn install v1.22.19
12:55:36 PM: [1/4] Resolving packages...
12:55:42 PM: warning @nguniversal/express-engine > @nguniversal/common > jsdom > w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
warning @angular-devkit/build-angular > cacache > @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
12:55:44 PM: warning @angular/cli > pacote > cacache > @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
12:55:44 PM: warning @angular/cli > @angular-devkit/schematics > magic-string > sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
12:55:44 PM: warning @angular/compiler-cli > sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
12:55:44 PM: warning @angular/compiler-cli > magic-string > sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
12:55:45 PM: warning @nguniversal/builders > guess-parser > @wessberg/ts-evaluator@0.0.27: this package has been renamed to ts-evaluator. Please install ts-evaluator instead
12:55:46 PM: warning @nguniversal/builders > guess-parser > @wessberg/ts-evaluator > jsdom > w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
warning cpx > chokidar@1.7.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
12:55:46 PM: warning cpx > chokidar > fsevents@1.2.13: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2
12:55:46 PM: warning cpx > babel-runtime > core-js@2.6.12: 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.
12:55:46 PM: warning cpx > chokidar > readdirp > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
12:55:46 PM: warning cpx > chokidar > readdirp > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
12:55:46 PM: warning cpx > chokidar > readdirp > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
12:55:46 PM: warning cpx > chokidar > readdirp > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
12:55:47 PM: [2/4] Fetching packages...
12:56:04 PM: [3/4] Linking dependencies...
12:56:04 PM: warning " > @angular/localize@14.2.12" has incorrect peer dependency "@angular/compiler@14.2.12".
12:56:04 PM: warning " > @angular/localize@14.2.12" has incorrect peer dependency "@angular/compiler-cli@14.2.12".
12:56:17 PM: [4/4] Building fresh packages...
12:56:19 PM: success Saved lockfile.
12:56:19 PM: Done in 42.96s.
12:56:19 PM: npm packages installed using Yarn
12:56:19 PM: Install dependencies script success
12:56:19 PM: Starting build script
12:56:20 PM: Detected 1 framework(s)
12:56:20 PM: "angular" at version "14.2.11"
12:56:20 PM: Section completed: initializing
12:56:22 PM: ​
12:56:22 PM: Netlify Build                                                 
12:56:22 PM: ────────────────────────────────────────────────────────────────
12:56:22 PM: ​
12:56:22 PM: ❯ Version
12:56:22 PM:   @netlify/build 29.12.1
12:56:22 PM: ​
12:56:22 PM: ❯ Flags
12:56:22 PM:   baseRelDir: true
12:56:22 PM:   buildId: 6486f969b9783b1631d4d4c5
12:56:22 PM:   deployId: 6486f969b9783b1631d4d4c7
12:56:22 PM: ​
12:56:22 PM: ❯ Current directory
12:56:22 PM:   /opt/build/repo
12:56:22 PM: ​
12:56:22 PM: ❯ Config file
12:56:22 PM:   No config file was defined: using default values.
12:56:22 PM: ​
12:56:22 PM: ❯ Context
12:56:22 PM:   production
12:56:22 PM: ​
12:56:22 PM: Build command from Netlify app                                
12:56:22 PM: ────────────────────────────────────────────────────────────────
12:56:22 PM: ​
12:56:22 PM: $ yarn deploy:netlify
12:56:22 PM: yarn run v1.22.19
12:56:22 PM: $ ng run malmo-landing-angular:prerender && cp src/_redirects dist/malmo-landing-angular/browser && cp src/robots.txt dist/malmo-landing-angular/browser && cp src/sitemap.xml dist/malmo-landing-angular/browser && cp src/assets/lotties/drag-animation.json dist/malmo-landing-angular/browser/drag-animation.json && cp src/assets/img/malmo-og-image.png dist/malmo-landing-angular/browser/malmo-og-image.png
12:56:26 PM: - Generating server application bundles (phase: setup)...
12:56:26 PM: - Generating browser application bundles (phase: setup)...
12:57:11 PM: ✔ Browser application bundle generation complete.
12:57:11 PM: ✔ Browser application bundle generation complete.
12:57:11 PM: - Generating localized bundles...
12:57:14 PM: ✔ Localized bundle generation complete.
12:57:14 PM: - Copying assets...
12:57:14 PM: ✔ Copying assets complete.
12:57:14 PM: - Generating index html...
12:57:14 PM: ✔ Index html generation complete.
12:57:14 PM: Initial Chunk Files           | Names         | Raw Size | Estimated Transfer Size
12:57:14 PM: main.8b116448e311ce77.js      | main          |  1.21 MB |               270.30 kB
12:57:14 PM: polyfills.001206a0d5d3d25f.js | polyfills     | 33.13 kB |                10.66 kB
12:57:14 PM: styles.659e33377e60e994.css   | styles        |  9.42 kB |                 1.84 kB
12:57:14 PM: runtime.97bad3d579164f31.js   | runtime       |  1.41 kB |               797 bytes
12:57:14 PM: 
12:57:14 PM:                               | Initial Total |  1.25 MB |               283.58 kB
12:57:14 PM: 
12:57:14 PM: Lazy Chunk Files              | Names         | Raw Size | Estimated Transfer Size
12:57:14 PM: common.1adb061cc1743292.js    | common        |  3.62 kB |               966 bytes
12:57:14 PM: 948.6027785dbb7e76bc.js       | -             |  1.56 kB |               837 bytes
12:57:14 PM: 783.dfa15ee067e03ab6.js       | -             |  1.55 kB |               830 bytes
12:57:14 PM: 660.6828714fcf55c01c.js       | -             |  1.54 kB |               834 bytes
12:57:14 PM: 
12:57:14 PM: Build at: 2023-06-12T10:57:14.276Z - Hash: bfbe37eba19ab95a - Time: 47315ms
12:57:14 PM: 
12:57:14 PM: ./src/app/core/footer/footer.component.scss?ngResource - Warning: Module Warning (from ./node_modules/postcss-loader/dist/cjs.js):
12:57:14 PM: Warning
12:57:14 PM: 
12:57:14 PM: (19:3) autoprefixer: start value has mixed support, consider using flex-start instead
12:57:14 PM: 
12:57:14 PM: ./src/app/shared/three-scene/three-scene.component.scss?ngResource - Warning: Module Warning (from ./node_modules/postcss-loader/dist/cjs.js):
12:57:14 PM: Warning
12:57:14 PM: 
12:57:14 PM: (11:3) autoprefixer: start value has mixed support, consider using flex-start instead
12:57:14 PM: 
12:57:14 PM: ./src/app/shared/three-scene/three-scene.component.scss?ngResource - Warning: Module Warning (from ./node_modules/postcss-loader/dist/cjs.js):
12:57:14 PM: Warning
12:57:14 PM: 
12:57:14 PM: (40:3) autoprefixer: start value has mixed support, consider using flex-start instead
12:57:14 PM: 
12:57:14 PM: Warning: /opt/build/repo/src/app/home/home.component.scss exceeded maximum budget. Budget 8.00 kB was not met by 1005 bytes with a total of 8.98 kB.
12:57:14 PM: 
12:57:14 PM: 
12:57:16 PM: ✔ Server application bundle generation complete.
12:57:16 PM: ✔ Server application bundle generation complete.
12:57:16 PM: - Generating localized bundles...
12:57:22 PM: ✔ Localized bundle generation complete.
12:57:22 PM: Initial Chunk Files | Names         | Raw Size
12:57:22 PM: main.js             | main          |  5.13 MB | 
12:57:22 PM: 
12:57:22 PM:                     | Initial Total |  5.13 MB
12:57:22 PM: 
12:57:22 PM: Build at: 2023-06-12T10:57:22.229Z - Hash: db4976db6ad7a267 - Time: 55279ms
12:57:22 PM: 
12:57:22 PM: ./src/app/core/footer/footer.component.scss?ngResource - Warning: Module Warning (from ./node_modules/postcss-loader/dist/cjs.js):
12:57:22 PM: Warning
12:57:22 PM: 
12:57:22 PM: (19:3) autoprefixer: start value has mixed support, consider using flex-start instead
12:57:22 PM: 
12:57:22 PM: ./src/app/shared/three-scene/three-scene.component.scss?ngResource - Warning: Module Warning (from ./node_modules/postcss-loader/dist/cjs.js):
12:57:22 PM: Warning
12:57:22 PM: 
12:57:22 PM: (11:3) autoprefixer: start value has mixed support, consider using flex-start instead
12:57:22 PM: 
12:57:22 PM: ./src/app/shared/three-scene/three-scene.component.scss?ngResource - Warning: Module Warning (from ./node_modules/postcss-loader/dist/cjs.js):
12:57:22 PM: Warning
12:57:22 PM: 
12:57:22 PM: (40:3) autoprefixer: start value has mixed support, consider using flex-start instead
12:57:22 PM: 
12:57:22 PM: 
12:57:22 PM: - Prerendering 5 route(s) to /opt/build/repo/dist/malmo-landing-angular/browser/it...
12:57:23 PM: Unhandled Promise rejection: navigator is not defined ; Zone: <root> ; Task: Promise.then ; Value: ReferenceError: navigator is not defined
12:57:23 PM:     at Object.30707 (/opt/build/repo/dist/malmo-landing-angular/server/it/main.js:3:884558)
12:57:23 PM:     at __webpack_require__ (/opt/build/repo/dist/malmo-landing-angular/server/it/main.js:3:2670492)
12:57:23 PM:     at /opt/build/repo/dist/malmo-landing-angular/server/it/main.js:3:5376162
12:57:23 PM:     at /opt/build/repo/dist/malmo-landing-angular/server/it/main.js:3:5381078
12:57:23 PM:     at Object.<anonymous> (/opt/build/repo/dist/malmo-landing-angular/server/it/main.js:3:5381310)
12:57:23 PM:     at Module._compile (internal/modules/cjs/loader.js:1085:14)
12:57:23 PM:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
12:57:23 PM:     at Module.load (internal/modules/cjs/loader.js:950:32)
12:57:23 PM:     at Function.Module._load (internal/modules/cjs/loader.js:790:12)
12:57:23 PM:     at Module.require (internal/modules/cjs/loader.js:974:19) ReferenceError: navigator is not defined
12:57:23 PM:     at Object.30707 (/opt/build/repo/dist/malmo-landing-angular/server/it/main.js:3:884558)
12:57:23 PM:     at __webpack_require__ (/opt/build/repo/dist/malmo-landing-angular/server/it/main.js:3:2670492)
12:57:23 PM:     at /opt/build/repo/dist/malmo-landing-angular/server/it/main.js:3:5376162
12:57:23 PM:     at /opt/build/repo/dist/malmo-landing-angular/server/it/main.js:3:5381078
12:57:23 PM:     at Object.<anonymous> (/opt/build/repo/dist/malmo-landing-angular/server/it/main.js:3:5381310)
12:57:23 PM:     at Module._compile (internal/modules/cjs/loader.js:1085:14)
12:57:23 PM:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
12:57:23 PM:     at Module.load (internal/modules/cjs/loader.js:950:32)
12:57:23 PM:     at Function.Module._load (internal/modules/cjs/loader.js:790:12)
12:57:23 PM:     at Module.require (internal/modules/cjs/loader.js:974:19)
12:57:23 PM: ✖ Prerendering routes to /opt/build/repo/dist/malmo-landing-angular/browser/it failed.
12:57:23 PM: navigator is not defined
12:57:23 PM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
12:57:23 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
12:57:23 PM: ​
12:57:23 PM: "build.command" failed                                        
12:57:23 PM: ────────────────────────────────────────────────────────────────
12:57:23 PM: ​
12:57:23 PM:   Error message
12:57:23 PM:   Command failed with exit code 1: yarn deploy:netlify (https://ntl.fyi/exit-code-1)
12:57:23 PM: ​
12:57:23 PM:   Error location
12:57:23 PM:   In Build command from Netlify app:
12:57:23 PM:   yarn deploy:netlify
12:57:23 PM: ​
12:57:23 PM:   Resolved config
12:57:23 PM:   build:
12:57:23 PM:     command: yarn deploy:netlify
12:57:23 PM:     commandOrigin: ui
12:57:23 PM:     publish: /opt/build/repo/dist/malmo-landing-angular/browser
12:57:23 PM:     publishOrigin: ui
12:57:24 PM: Caching artifacts
12:57:24 PM: Started saving node modules
12:57:24 PM: Finished saving node modules
12:57:24 PM: Started saving build plugins
12:57:24 PM: Finished saving build plugins
12:57:24 PM: Started saving corepack cache
12:57:24 PM: Finished saving corepack cache
12:57:24 PM: Started saving yarn cache
12:57:26 PM: Finished saving yarn cache
12:57:26 PM: Started saving pip cache
12:57:26 PM: Finished saving pip cache
12:57:26 PM: Started saving emacs cask dependencies
12:57:26 PM: Finished saving emacs cask dependencies
12:57:26 PM: Started saving maven dependencies
12:57:26 PM: Finished saving maven dependencies
12:57:26 PM: Started saving boot dependencies
12:57:26 PM: Finished saving boot dependencies
12:57:26 PM: Started saving rust rustup cache
12:57:26 PM: Finished saving rust rustup cache
12:57:26 PM: Started saving go dependencies
12:57:26 PM: Finished saving go dependencies
12:57:27 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:57:27 PM: Failing build: Failed to build site
12:57:27 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
12:57:28 PM: Finished processing build request in 2m53.431s

We found out that a third party library was updated during the build process (so yarn.lock was ignored :sweat_smile:), and it was using the window.navigator object, which was not found as we are using Angular Universal SSR. So we locked the the compatible version in our package.json and fixed our issue.

thanks for coming back and sharing your solution with the community! This is awesome.