Deploy did not succeed: Deploy directory 'dist' does not exist Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)

https://app.netlify.com/sites/elaborate-daifuku-05d148

9:21:12 PM: Build ready to start
9:21:14 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
9:21:14 PM: build-image tag: v4.10.1
9:21:14 PM: buildbot version: fe6512288e75c8fa5aadaebb51ed1f96e9314fd4
9:21:14 PM: Fetching cached dependencies
9:21:14 PM: Failed to fetch cache, continuing with build
9:21:14 PM: Starting to prepare the repo for build
9:21:14 PM: No cached dependencies found. Cloning fresh repo
9:21:14 PM: git clone GitHub - TetianaStrelnikova/tetiana-strelnikova-homework-week-3-responsive
9:21:15 PM: Preparing Git Reference refs/heads/main
9:21:15 PM: Parsing package.json dependencies
9:21:16 PM: Starting build script
9:21:16 PM: Installing dependencies
9:21:16 PM: Python version set to 2.7
9:21:16 PM: v16.16.0 is already installed.
9:21:17 PM: Now using node v16.16.0 (npm v8.11.0)
9:21:17 PM: Started restoring cached build plugins
9:21:17 PM: Finished restoring cached build plugins
9:21:17 PM: Attempting ruby version 2.7.2, read from environment
9:21:17 PM: Using ruby version 2.7.2
9:21:17 PM: Using PHP version 8.0
9:21:18 PM: No npm workspaces detected
9:21:18 PM: Started restoring cached node modules
9:21:18 PM: Finished restoring cached node modules
9:21:18 PM: Installing NPM modules using NPM version 8.11.0
9:21:18 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
9:21:18 PM: npm WARN config location in the cache, and they are managed by
9:21:18 PM: npm WARN config cacache.
9:21:18 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
9:21:18 PM: npm WARN config location in the cache, and they are managed by
9:21:18 PM: npm WARN config cacache.
9:21:21 PM: added 78 packages, and audited 79 packages in 2s
9:21:21 PM: 1 package is looking for funding
9:21:21 PM: run npm fund for details
9:21:21 PM: 2 moderate severity vulnerabilities
9:21:21 PM: To address all issues (including breaking changes), run:
9:21:21 PM: npm audit fix --force
9:21:21 PM: Run npm audit for details.
9:21:21 PM: NPM modules installed
9:21:21 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
9:21:21 PM: npm WARN config location in the cache, and they are managed by
9:21:21 PM: npm WARN config cacache.
9:21:21 PM: Started restoring cached go cache
9:21:21 PM: Finished restoring cached go cache
9:21:21 PM: Installing Go version 1.17 (requested 1.17)
9:21:25 PM: unset GOOS;
9:21:25 PM: unset GOARCH;
9:21:25 PM: export GOROOT=‘/opt/buildhome/.gimme/versions/go1.17.linux.amd64’;
9:21:25 PM: export PATH=“/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}”;
9:21:25 PM: go version >&2;
9:21:25 PM: export GIMME_ENV=“/opt/buildhome/.gimme/env/go1.17.linux.amd64.env”
9:21:25 PM: go version go1.17 linux/amd64
9:21:25 PM: Installing missing commands
9:21:25 PM: Verify run directory
9:21:27 PM: ​
9:21:27 PM: ────────────────────────────────────────────────────────────────
9:21:27 PM: Netlify Build
9:21:27 PM: ────────────────────────────────────────────────────────────────
9:21:27 PM: ​
9:21:27 PM: ❯ Version
9:21:27 PM: @netlify/build 27.9.1
9:21:27 PM: ​
9:21:27 PM: ❯ Flags
9:21:27 PM: baseRelDir: true
9:21:27 PM: buildId: 62f1460819d7c40008578b9b
9:21:27 PM: deployId: 62f1460819d7c40008578b9d
9:21:27 PM: systemLogFile: 3
9:21:27 PM: ​
9:21:27 PM: ❯ Current directory
9:21:27 PM: /opt/build/repo
9:21:27 PM: ​
9:21:27 PM: ❯ Config file
9:21:27 PM: No config file was defined: using default values.
9:21:27 PM: ​
9:21:27 PM: ❯ Context
9:21:27 PM: production
9:21:27 PM: ​
9:21:27 PM: ────────────────────────────────────────────────────────────────
9:21:27 PM: 1. Build command from Netlify app
9:21:27 PM: ────────────────────────────────────────────────────────────────
9:21:27 PM: ​
9:21:27 PM: $ npm run build
9:21:27 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
9:21:27 PM: npm WARN config location in the cache, and they are managed by
9:21:27 PM: npm WARN config cacache.
9:21:27 PM: > advanced-bootstrap-homework-challenge@1.0.0 build
9:21:27 PM: > echo This is a static template, there is no bundler or bundling involved!
9:21:27 PM: This is a static template, there is no bundler or bundling involved!
9:21:27 PM: ​
9:21:27 PM: (build.command completed in 227ms)
9:21:27 PM: ​
9:21:27 PM: ────────────────────────────────────────────────────────────────
9:21:27 PM: 2. Deploy site
9:21:27 PM: ────────────────────────────────────────────────────────────────
9:21:27 PM: ​
9:21:27 PM: ​
9:21:27 PM: ────────────────────────────────────────────────────────────────
9:21:27 PM: Configuration error
9:21:27 PM: ────────────────────────────────────────────────────────────────
9:21:27 PM: ​
9:21:27 PM: Error message
9:21:27 PM: Deploy did not succeed: Deploy directory ‘dist’ does not exist
9:21:27 PM: ​
9:21:27 PM: Resolved config
9:21:27 PM: build:
9:21:27 PM: command: npm run build
9:21:27 PM: commandOrigin: ui
9:21:27 PM: publish: /opt/build/repo/dist
9:21:27 PM: publishOrigin: ui
9:21:27 PM: Caching artifacts
9:21:27 PM: Started saving node modules
9:21:27 PM: Finished saving node modules
9:21:27 PM: Started saving build plugins
9:21:27 PM: Finished saving build plugins
9:21:27 PM: Started saving pip cache
9:21:27 PM: Finished saving pip cache
9:21:27 PM: Started saving emacs cask dependencies
9:21:27 PM: Finished saving emacs cask dependencies
9:21:27 PM: Started saving maven dependencies
9:21:27 PM: Finished saving maven dependencies
9:21:27 PM: Started saving boot dependencies
9:21:27 PM: Finished saving boot dependencies
9:21:27 PM: Started saving rust rustup cache
9:21:27 PM: Finished saving rust rustup cache
9:21:27 PM: Started saving go dependencies
9:21:27 PM: Finished saving go dependencies
9:21:28 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:21:28 PM: Creating deploy upload records
9:21:28 PM: Failing build: Failed to build site
9:21:28 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)
9:21:28 PM: Finished processing build request in 14.144068827s

The better the post - the faster the answer.

Hi @strelnikova

This is because all the files that constitute the site you are trying to deploy exist at the root of the repository.

There is also no need for you to run this command—it is only echoing a string to the console.

Remove the build command, and the publish directory and re-deploy your site.