Error Deploying Angular App

Hi team,

I receive the errors shown below when trying to deploy my angular app. It has something to do with the environment variables I used and created in the “environment.ts” file in the project code at the build time but I have yet to find a solution.

Any guidance on this matter would be appreciated.

site name: dynamic-rolypoly-f743b9 (link not yet generated)

github repo

4:58:50 PM: Build ready to start
4:58:56 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
4:58:56 PM: build-image tag: v4.8.0
4:58:56 PM: buildbot version: 390d88e493c735102b1572c705756b875d71a61b
4:58:56 PM: Fetching cached dependencies
4:58:56 PM: Failed to fetch cache, continuing with build
4:58:56 PM: Starting to prepare the repo for build
4:58:57 PM: No cached dependencies found. Cloning fresh repo
4:58:57 PM: git clone GitHub - Shakadeliks/angular-weather-app
4:58:57 PM: Preparing Git Reference refs/heads/master
4:58:57 PM: Parsing package.json dependencies
4:58:58 PM: Starting build script
4:58:58 PM: Installing dependencies
4:58:58 PM: Python version set to 2.7
4:58:59 PM: Downloading and installing node v16.15.1…
4:58:59 PM: Downloading https://nodejs.org/dist/v16.15.1/node-v16.15.1-linux-x64.tar.xz
4:59:00 PM: Computing checksum with sha256sum
4:59:00 PM: Checksums matched!
4:59:02 PM: Now using node v16.15.1 (npm v8.11.0)
4:59:02 PM: Started restoring cached build plugins
4:59:02 PM: Finished restoring cached build plugins
4:59:03 PM: Attempting ruby version 2.7.2, read from environment
4:59:04 PM: Using ruby version 2.7.2
4:59:04 PM: Using PHP version 8.0
4:59:05 PM: No npm workspaces detected
4:59:05 PM: Started restoring cached node modules
4:59:05 PM: Finished restoring cached node modules
4:59:05 PM: Installing NPM modules using NPM version 8.11.0
4:59:05 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
4:59:05 PM: npm WARN config location in the cache, and they are managed by
4:59:05 PM: npm WARN config cacache.
4:59:06 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
4:59:06 PM: npm WARN config location in the cache, and they are managed by
4:59:06 PM: npm WARN config
4:59:13 PM: npm WARN deprecated source-map-resolve@0.6.0: See
4:59:28 PM: added 930 packages, and audited 931 packages in 22s
4:59:28 PM: 104 packages are looking for funding
4:59:28 PM: run npm fund for details
4:59:28 PM: found 0 vulnerabilities
4:59:28 PM: NPM modules installed
4:59:28 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
4:59:28 PM: npm WARN config location in the cache, and they are managed by
4:59:28 PM: npm WARN config cacache.
4:59:28 PM: Started restoring cached go cache
4:59:28 PM: Finished restoring cached go cache
4:59:28 PM: Installing Go version 1.17
4:59:34 PM: unset GOOS;
4:59:34 PM: unset GOARCH;
4:59:34 PM: export GOROOT=‘/opt/buildhome/.gimme_cache/versions/go1.17.linux.amd64’;
4:59:34 PM: export PATH=“/opt/buildhome/.gimme_cache/versions/go1.17.linux.amd64/bin:${PATH}”;
4:59:34 PM: go version >&2;
4:59:34 PM: export GIMME_ENV=“/opt/buildhome/.gimme_cache/env/go1.17.linux.amd64.env”
4:59:34 PM: go version go1.17 linux/amd64
4:59:34 PM: Installing missing commands
4:59:34 PM: Verify run directory
4:59:35 PM: ​
4:59:35 PM: ────────────────────────────────────────────────────────────────
4:59:35 PM: Netlify Build
4:59:35 PM: ────────────────────────────────────────────────────────────────
4:59:35 PM: ​
4:59:35 PM: ❯ Version
4:59:35 PM: @netlify/build 27.1.5
4:59:35 PM: ​
4:59:35 PM: ❯ Flags
4:59:35 PM: baseRelDir: true
4:59:35 PM: buildId: 62ac96aad68af77261416be5
4:59:35 PM: deployId: 62ac96aad68af77261416be7
4:59:35 PM: ​
4:59:35 PM: ❯ Current directory
4:59:35 PM: /opt/build/repo
4:59:35 PM: ​
4:59:35 PM: ❯ Config file
4:59:35 PM: No config file was defined: using default values.
4:59:35 PM: ​
4:59:35 PM: ❯ Context
4:59:35 PM: production
4:59:35 PM: ​
4:59:35 PM: ────────────────────────────────────────────────────────────────
4:59:35 PM: 1. Build command from Netlify app
4:59:35 PM: ────────────────────────────────────────────────────────────────
4:59:35 PM: ​
4:59:35 PM: $ ng build
4:59:38 PM: - Generating browser application bundles (phase: setup)…
5:00:02 PM: :heavy_check_mark: Browser application bundle generation complete.
5:00:02 PM: :heavy_check_mark: Browser application bundle generation complete.
5:00:02 PM:
5:00:02 PM: ./src/styles.css.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[4].rules[0].oneOf[0].use[2]!./src/styles.css - Warning: Module Warning (from ./node_modules/postcss-loader/dist/cjs.js):
5:00:02 PM: Warning
5:00:02 PM:
5:00:02 PM: (137:5) autoprefixer: start value has mixed support, consider using flex-start instead
5:00:02 PM:
5:00:02 PM:
5:00:02 PM:
5:00:02 PM: Error: src/app/services/weather.service.ts:15:52 - error TS2339: Property ‘weatherApiBaseUrl’ does not exist on type ‘{ production: boolean; }’.
5:00:02 PM:
5:00:02 PM: 15 return this.http.get(environment.weatherApiBaseUrl, {
5:00:02 PM: ~~~~~~~~~~~~~~~~~
5:00:02 PM:
5:00:02 PM:
5:00:02 PM: Error: src/app/services/weather.service.ts:17:26 - error TS2339: Property ‘XRapidAPIHostHeader’ does not exist on type ‘{ production: boolean; }’.
5:00:02 PM:
5:00:02 PM: 17 .set(environment.XRapidAPIHostHeader, environment.XRapidAPIHostHeaderValue)
5:00:02 PM: ~~~~~~~~~~~~~~~~~~~
5:00:02 PM:
5:00:02 PM:
5:00:02 PM: Error: src/app/services/weather.service.ts:17:59 - error TS2339: Property ‘XRapidAPIHostHeaderValue’ does not exist on type ‘{ production: boolean; }’.
5:00:02 PM:
5:00:02 PM: 17 .set(environment.XRapidAPIHostHeader, environment.XRapidAPIHostHeaderValue)
5:00:02 PM: ~~~~~~~~~~~~~~~~~~~~~~~~
5:00:02 PM:
5:00:02 PM:
5:00:02 PM: Error: src/app/services/weather.service.ts:18:26 - error TS2339: Property ‘XRapidAPIKeyHeader’ does not exist on type ‘{ production: boolean; }’.
5:00:02 PM:
5:00:02 PM: 18 .set(environment.XRapidAPIKeyHeader, environment.XRapidAPIKeyValue),
5:00:02 PM: ~~~~~~~~~~~~~~~~~~
5:00:02 PM:
5:00:02 PM:
5:00:02 PM: Error: src/app/services/weather.service.ts:18:58 - error TS2339: Property ‘XRapidAPIKeyValue’ does not exist on type ‘{ production: boolean; }’.
5:00:02 PM:
5:00:02 PM: 18 .set(environment.XRapidAPIKeyHeader, environment.XRapidAPIKeyValue),
5:00:02 PM: ~~~~~~~~~~~~~~~~~
5:00:02 PM:
5:00:02 PM:
5:00:02 PM:
5:00:02 PM: ​
5:00:02 PM: ────────────────────────────────────────────────────────────────
5:00:02 PM: “build.command” failed
5:00:02 PM: ────────────────────────────────────────────────────────────────
5:00:02 PM: ​
5:00:02 PM: Error message
5:00:02 PM: Command failed with exit code 1: ng build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
5:00:02 PM: ​
5:00:02 PM: Error location
5:00:02 PM: In Build command from Netlify app:
5:00:02 PM: ng build
5:00:02 PM: ​
5:00:02 PM: Resolved config
5:00:02 PM: build:
5:00:02 PM: command: ng build
5:00:02 PM: commandOrigin: ui
5:00:02 PM: publish: /opt/build/repo/dist
5:00:02 PM: publishOrigin: ui
5:00:03 PM: Caching artifacts
5:00:03 PM: Started saving node modules
5:00:03 PM: Finished saving node modules
5:00:03 PM: Started saving build plugins
5:00:03 PM: Finished saving build plugins
5:00:03 PM: Started saving pip cache
5:00:03 PM: Finished saving pip cache
5:00:03 PM: Started saving emacs cask dependencies
5:00:03 PM: Finished saving emacs cask dependencies
5:00:03 PM: Started saving maven dependencies
5:00:03 PM: Finished saving maven dependencies
5:00:03 PM: Started saving boot dependencies
5:00:03 PM: Finished saving boot dependencies
5:00:03 PM: Started saving rust rustup cache
5:00:03 PM: Finished saving rust rustup cache
5:00:03 PM: Started saving go dependencies
5:00:05 PM: Finished saving go dependencies
5:00:10 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:00:10 PM: Creating deploy upload records
5:00:10 PM: Failing build: Failed to build site
5:00:10 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
5:00:10 PM: Finished processing build request in 1m14.0989449s

Hiya, sorry you are having trouble with your build.

This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile: Additionally, this Support Guide houses all of our resources for debugging build and deploy issues.

We also recommend trying to search the forums with the build error you encountered - it’s likely your question was already asked by someone else!

If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, etc. Thanks!