Hi, I need help! I’m at a loss for solutions.
I’m trying to deploy an Angular one-page website. I’m using Netlify Angular template but the build keeps failing and I don’t really know what to do anymore, since I’ve been trying for hours now. I’ve tried many things, I’ve set up the env variable NPM_FLAGS to false but still get this pretty generic error.
When Googling for a solution, I only find solutions for React apps, but they obv don’t work in this case. Please help a fellow stuck dev :')
4:50:07 PM: build-image version: 20e1f1f500e4cbad9ea8a99bd40807bef3093551 (focal)
4:50:07 PM: buildbot version: 20e1f1f500e4cbad9ea8a99bd40807bef3093551
4:50:07 PM: Building without cache
4:50:07 PM: Starting to prepare the repo for build
4:50:08 PM: No cached dependencies found. Cloning fresh repo
4:50:08 PM: git clone --filter=blob:none git@github.com:Sue-svbd/my-online-profile
4:50:08 PM: Preparing Git Reference refs/heads/main
4:50:09 PM:
❯ Initial build environment
baseRelDir: true
branch: main
context: production
cwd: /opt/build/repo
featureFlags:
mode: buildbot
repositoryRoot: /opt/build/repo
siteId: c9ece4e8-7b90-41c6-a251-381981489615
❯ UI build settings
baseRelDir: true
build:
command: ng build
environment:
- NETLIFY_BUILD_DEBUG
- NPM_FLAGS
publish: dist/my-online-profile
❯ Resolved build environment
branch: main
buildDir: /opt/build/repo
configPath: /opt/build/repo/netlify.toml
context: production
env:
❯ Resolved config
build:
command: ng build
commandOrigin: config
environment:
- NETLIFY_BUILD_DEBUG
- NPM_FLAGS
publish: /opt/build/repo/dist/my-online-profile
publishOrigin: config
redirects:
- from: /*
status: 200
to: /index.html
redirectsOrigin: config
4:50:10 PM: Starting to install dependencies
4:50:10 PM: Python version set to 3.8
4:50:10 PM: Attempting Ruby version 2.7.2, read from environment
4:50:11 PM: Using Ruby version 2.7.2
4:50:11 PM: Started restoring cached go cache
4:50:11 PM: Finished restoring cached go cache
4:50:11 PM: go version go1.19.11 linux/amd64
4:50:12 PM: Using PHP version 8.0
4:50:12 PM: v18.17.0 is already installed.
4:50:13 PM: Now using node v18.17.0 (npm v9.6.7)
4:50:13 PM: Enabling Node.js Corepack
4:50:13 PM: Started restoring cached build plugins
4:50:13 PM: Finished restoring cached build plugins
4:50:13 PM: Started restoring cached corepack dependencies
4:50:13 PM: Finished restoring cached corepack dependencies
4:50:13 PM: No npm workspaces detected
4:50:13 PM: Started restoring cached node modules
4:50:13 PM: Finished restoring cached node modules
4:50:13 PM: Installing npm packages using npm version 9.6.7
4:50:13 PM: npm WARN using --force Recommended protections disabled.
4:50:20 PM: added 908 packages, and audited 909 packages in 7s
4:50:20 PM: 102 packages are looking for funding
4:50:20 PM: run npm fund
for details
4:50:20 PM: 6 vulnerabilities (3 moderate, 1 high, 2 critical)
4:50:20 PM: To address all issues, run:
4:50:20 PM: npm audit fix
4:50:20 PM: Run npm audit
for details.
4:50:20 PM: npm packages installed
4:50:20 PM: Install dependencies script success
4:50:20 PM: Starting build script
4:50:21 PM: Detected 1 framework(s)
4:50:21 PM: angular at version 16.1.6
4:50:21 PM: Section completed: initializing
4:50:23 PM:
4:50:23 PM: Netlify Build
4:50:23 PM: ────────────────────────────────────────────────────────────────
4:50:23 PM:
4:50:23 PM: ❯ Version
4:50:23 PM: @netlify/build 29.17.2
4:50:23 PM:
4:50:23 PM: ❯ Flags
4:50:23 PM: apiHost: api.netlify.com
4:50:23 PM: baseRelDir: true
4:50:23 PM: branch: main
4:50:23 PM: buildId: 64c678927331c00e68625c65
4:50:23 PM: buildbotServerSocket: /tmp/netlify-buildbot-socket
4:50:23 PM: cacheDir: /opt/build/cache
4:50:23 PM: cachedConfigPath: /tmp/netlify_config.json
4:50:23 PM: context: production
4:50:23 PM: cwd: /opt/build/repo
4:50:23 PM: deployId: 64c678927331c00e68625c67
4:50:23 PM: edgeFunctionsDistDir: /tmp/edge-64c678927331c00e68625c67
4:50:23 PM: featureFlags:
4:50:23 PM: - buildbot_zisi_system_log
4:50:23 PM: - edge_functions_cache_cli
4:50:23 PM: - edge_functions_system_logger
4:50:23 PM: framework: angular
4:50:23 PM: functionsDistDir: /tmp/zisi-64c678927331c00e68625c67
4:50:23 PM: mode: buildbot
4:50:23 PM: nodePath: /opt/buildhome/.nvm/versions/node/v18.17.0/bin/node
4:50:23 PM: repositoryRoot: /opt/build/repo
4:50:23 PM: saveConfig: true
4:50:23 PM: sendStatus: true
4:50:23 PM: siteId: c9ece4e8-7b90-41c6-a251-381981489615
4:50:23 PM: statsd:
4:50:23 PM: host: 10.65.132.114
4:50:23 PM: port: 8125
4:50:23 PM: systemLogFile: 3
4:50:23 PM: testOpts:
4:50:23 PM: silentLingeringProcesses: ‘’
4:50:23 PM: tracing:
4:50:23 PM: enabled: true
4:50:23 PM: host: 10.65.132.114
4:50:23 PM: parent-span-id: 87dec1e52f0cf5f8
4:50:23 PM: parentSpanId: 87dec1e52f0cf5f8
4:50:23 PM: sample-rate: 4
4:50:23 PM: sampleRate: 4
4:50:23 PM: trace-flags: 0
4:50:23 PM: trace-id: 70b4880d1a1a92caa82021263d2aa2f8
4:50:23 PM: traceFlags: 0
4:50:23 PM: traceId: 70b4880d1a1a92caa82021263d2aa2f8
4:50:23 PM:
4:50:23 PM: ❯ Current directory
4:50:23 PM: /opt/build/repo
4:50:23 PM:
4:50:23 PM: ❯ Config file
4:50:23 PM: /opt/build/repo/netlify.toml
4:50:23 PM:
4:50:23 PM: ❯ Resolved config
4:50:23 PM: build:
4:50:23 PM: command: ng build
4:50:23 PM: commandOrigin: config
4:50:23 PM: environment:
4:50:23 PM: - NETLIFY_BUILD_DEBUG
4:50:23 PM: - NPM_FLAGS
4:50:23 PM: publish: /opt/build/repo/dist/my-online-profile
4:50:23 PM: publishOrigin: config
4:50:23 PM: redirects:
4:50:23 PM: - from: /*
status: 200
to: /index.html
redirectsOrigin: config
4:50:23 PM: ❯ Context
4:50:23 PM: production
4:50:23 PM:
4:50:23 PM: build.command from netlify.toml
4:50:23 PM: ────────────────────────────────────────────────────────────────
4:50:23 PM:
4:50:23 PM: $ ng build
4:50:24 PM: - Generating browser application bundles (phase: setup)…
4:50:39 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
4:50:37 PM: Browser application bundle generation complete.
4:50:37 PM: Browser application bundle generation complete.
4:50:37 PM: - Copying assets…
4:50:37 PM: Copying assets complete.
4:50:37 PM: - Generating index html…
4:50:37 PM: Index html generation complete.
4:50:37 PM: Initial Chunk Files | Names | Raw Size | Estimated Transfer Size
4:50:37 PM: main.949e4e450a67f419.js | main | 606.47 kB | 108.53 kB
4:50:37 PM: styles.76f28b84868fa52a.css | styles | 166.02 kB | 15.99 kB
4:50:37 PM: polyfills.407a3a6ee5a7ccd5.js | polyfills | 33.01 kB | 10.61 kB
4:50:37 PM: runtime.9aad10c2930ce5eb.js | runtime | 890 bytes | 513 bytes
4:50:37 PM:
4:50:37 PM: | Initial Total | 806.37 kB | 135.63 kB
4:50:37 PM:
4:50:37 PM: Build at: 2023-07-30T14:50:37.833Z - Hash: 2d0552008945a4e0 - Time: 13578ms
4:50:37 PM:
4:50:37 PM: (build.command completed in 14.7s)
4:50:37 PM: Build step duration: build.command completed in 14795ms
4:50:37 PM:
4:50:37 PM: Deploy site
4:50:37 PM: ────────────────────────────────────────────────────────────────
4:50:37 PM:
4:50:37 PM:
4:50:37 PM: ❯ Uploaded config
4:50:37 PM: [build]
4:50:37 PM: command=ng build
4:50:37 PM: publish=dist/my-online-profile
4:50:37 PM:
4:50:37 PM: [[redirects]]
4:50:37 PM: from = /*
4:50:37 PM: to = /index.html
4:50:37 PM: status = 200
4:50:37 PM:
4:50:37 PM: ❯ Uploaded headers
4:50:37 PM: No headers
4:50:37 PM:
4:50:37 PM: ❯ Uploaded redirects
4:50:37 PM: No redirects
4:50:37 PM:
4:50:37 PM: Section completed: deploying
4:50:37 PM:
4:50:37 PM: Configuration error
4:50:37 PM: ────────────────────────────────────────────────────────────────
4:50:37 PM:
4:50:37 PM: Error message
4:50:37 PM: Deploy did not succeed: Deploy directory ‘dist/my-online-profile’ does not exist
4:50:37 PM:
4:50:37 PM: Resolved config
4:50:37 PM: build:
4:50:37 PM: command: ng build
4:50:37 PM: commandOrigin: config
4:50:37 PM: environment:
4:50:37 PM: - NETLIFY_BUILD_DEBUG
4:50:37 PM: - NPM_FLAGS
4:50:37 PM: publish: /opt/build/repo/dist/my-online-profile
4:50:37 PM: publishOrigin: config
4:50:37 PM: redirects:
4:50:38 PM: - from: /*
status: 200
to: /index.html
redirectsOrigin: config
Caching artifacts
4:50:38 PM: Started saving node modules
4:50:38 PM: Finished saving node modules
4:50:38 PM: Started saving build plugins
4:50:38 PM: Finished saving build plugins
4:50:38 PM: Started saving corepack cache
4:50:38 PM: Finished saving corepack cache
4:50:38 PM: Started saving pip cache
4:50:38 PM: Finished saving pip cache
4:50:38 PM: Started saving emacs cask dependencies
4:50:38 PM: Finished saving emacs cask dependencies
4:50:38 PM: Started saving maven dependencies
4:50:38 PM: Finished saving maven dependencies
4:50:38 PM: Started saving boot dependencies
4:50:38 PM: Finished saving boot dependencies
4:50:38 PM: Started saving rust rustup cache
4:50:38 PM: Finished saving rust rustup cache
4:50:38 PM: Started saving go dependencies
4:50:38 PM: Finished saving go dependencies
4:50:39 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:50:39 PM: Failing build: Failed to build site
4:50:39 PM: Finished processing build request in 32.136s