Deploy directory 'dist' does not exist

Hi,

I tried building a website on Netlify using threejs. I have deployed similar websites earlier. But this time I am getting this - Deploy directory ‘dist’ does not exist. I am using rollup to deploy my website in this case.

Also, I have attached the deploy log along with this thread.

Any help in resolving this problem is very much appreciated.
Thank you for your help.

7:17:26 PM: build-image version: c1f0e3189beff44ebec7048bf7ab2e75cb09660b (focal)
7:17:26 PM: buildbot version: c1f0e3189beff44ebec7048bf7ab2e75cb09660b
7:17:26 PM: Fetching cached dependencies
7:17:26 PM: Failed to fetch cache, continuing with build
7:17:26 PM: Starting to prepare the repo for build
7:17:26 PM: No cached dependencies found. Cloning fresh repo
7:17:26 PM: git clone --filter=blob:none https://github.com/keshavanarayan//*hiding repo name*/
7:17:27 PM: Preparing Git Reference refs/heads/main
7:17:33 PM: Parsing package.json dependencies
7:17:34 PM: Starting build script
7:17:34 PM: Installing dependencies
7:17:34 PM: Python version set to 2.7
7:17:34 PM: v16.19.1 is already installed.
7:17:35 PM: Now using node v16.19.1 (npm v8.19.3)
7:17:35 PM: Enabling Node.js Corepack
7:17:35 PM: Started restoring cached build plugins
7:17:35 PM: Finished restoring cached build plugins
7:17:35 PM: Attempting Ruby version 2.7.2, read from environment
7:17:36 PM: Using Ruby version 2.7.2
7:17:36 PM: Using PHP version 8.0
7:17:36 PM: Started restoring cached corepack dependencies
7:17:36 PM: Finished restoring cached corepack dependencies
7:17:36 PM: No npm workspaces detected
7:17:36 PM: Started restoring cached node modules
7:17:36 PM: Finished restoring cached node modules
7:17:36 PM: Installing npm packages using npm version 8.19.3
7:17:38 PM: added 128 packages, and audited 129 packages in 2s
7:17:38 PM: 31 packages are looking for funding
7:17:38 PM: run npm fund for details
7:17:38 PM: found 0 vulnerabilities
7:17:39 PM: npm packages installed
7:17:39 PM: Started restoring cached go cache
7:17:39 PM: Finished restoring cached go cache
7:17:39 PM: go version go1.19.6 linux/amd64
7:17:39 PM: Detected 0 framework(s)
7:17:39 PM: Section completed: initializing
7:17:41 PM: ​
7:17:41 PM: Netlify Build
7:17:41 PM: ────────────────────────────────────────────────────────────────
7:17:41 PM: ​
7:17:41 PM: ❯ Version
7:17:41 PM: @netlify/build 29.5.8
7:17:41 PM: ​
7:17:41 PM: ❯ Flags
7:17:41 PM: baseRelDir: true
7:17:41 PM: buildId: 64034bed1f961b0008d541e7
7:17:41 PM: deployId: 64034bed1f961b0008d541e9
7:17:41 PM: ​
7:17:41 PM: ❯ Current directory
7:17:41 PM: /opt/build/repo
7:17:41 PM: ​
7:17:41 PM: ❯ Config file
7:17:41 PM: No config file was defined: using default values.
7:17:41 PM: ​
7:17:41 PM: ❯ Context
7:17:41 PM: production
7:17:41 PM: ​
7:17:41 PM: 1. Build command from Netlify app
7:17:41 PM: ────────────────────────────────────────────────────────────────
7:17:41 PM: ​
7:17:41 PM: $ yarn build
7:17:41 PM: yarn run v1.22.19
7:17:41 PM: $ rollup -c
7:17:41 PM:
7:17:41 PM: src/main.js → build/main.js…
7:17:44 PM: created build/main.js in 2.9s
7:17:44 PM: Done in 3.17s.
7:17:44 PM: ​
7:17:44 PM: (build.command completed in 3.3s)
7:17:44 PM: ​
7:17:44 PM: 2. Deploy site
7:17:44 PM: ────────────────────────────────────────────────────────────────
7:17:44 PM: ​
7:17:44 PM: Section completed: deploying
7:17:44 PM: ​
7:17:44 PM: Configuration error
7:17:44 PM: ────────────────────────────────────────────────────────────────
7:17:44 PM: ​
7:17:44 PM: Error message
7:17:44 PM: Deploy did not succeed: Deploy directory ‘dist’ does not exist
7:17:44 PM: ​
7:17:44 PM: Resolved config
7:17:44 PM: build:
7:17:44 PM: command: yarn build
7:17:44 PM: commandOrigin: ui
7:17:44 PM: publish: /opt/build/repo/dist
7:17:44 PM: publishOrigin: ui
7:17:45 PM: Caching artifacts
7:17:45 PM: Started saving node modules
7:17:45 PM: Finished saving node modules
7:17:45 PM: Started saving build plugins
7:17:45 PM: Finished saving build plugins
7:17:45 PM: Started saving corepack cache
7:17:45 PM: Finished saving corepack cache
7:17:45 PM: Started saving pip cache
7:17:45 PM: Finished saving pip cache
7:17:45 PM: Started saving emacs cask dependencies
7:17:45 PM: Finished saving emacs cask dependencies
7:17:45 PM: Started saving maven dependencies
7:17:45 PM: Finished saving maven dependencies
7:17:46 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)
7:17:45 PM: Started saving boot dependencies
7:17:45 PM: Finished saving boot dependencies
7:17:45 PM: Started saving rust rustup cache
7:17:45 PM: Finished saving rust rustup cache
7:17:45 PM: Started saving go dependencies
7:17:45 PM: Finished saving go dependencies
7:17:46 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
7:17:46 PM: Failing build: Failed to build site
7:17:46 PM: Finished processing build request in 19.961s

I presume that you have dist set as your Publish directory in your Build settings?

But the log of your build indicates it is producing the output into build

Have you run the build locally and confirmed that the dist folder is what you want to publish?

Hi @nathanmartin,

Thank you so much for the help.
For some reason, dist was mentioned in my publish directory as default.
Reverted as shown in the image. It works now. Thank you.

image