ENOENT: no such file or directory, mkdir '/opt/build/repo/dist'

Hi, my build won’t create a build folder.

8:12:54 PM: build-image version: 4c0c1cadee6a31c9bb8d824514030009c4c05c6a (focal)
8:12:54 PM: build-image tag: v4.15.0
8:12:54 PM: buildbot version: 1b4d875963b865c08089f01df4ac094d0921a24e
8:12:54 PM: Fetching cached dependencies
8:12:54 PM: Failed to fetch cache, continuing with build
8:12:54 PM: Starting to prepare the repo for build
8:12:54 PM: No cached dependencies found. Cloning fresh repo
8:12:54 PM: git clone git@bitbucket.org:spyderdsn/my-web-nuxt
8:13:12 PM: Preparing Git Reference refs/heads/master
8:13:13 PM: Parsing package.json dependencies
8:13:14 PM: Section completed: initializing
8:13:15 PM: Starting build script
8:13:15 PM: Installing dependencies
8:13:15 PM: Python version set to 2.7
8:13:15 PM: Attempting node version '16.16.0' from .node-version
8:13:15 PM: Downloading and installing node v16.16.0...
8:13:15 PM: Downloading https://nodejs.org/dist/v16.16.0/node-v16.16.0-linux-x64.tar.xz...
8:13:15 PM: Computing checksum with sha256sum
8:13:16 PM: Checksums matched!
8:13:17 PM: Now using node v16.16.0 (npm v8.11.0)
8:13:18 PM: Enabling node corepack
8:13:18 PM: Started restoring cached build plugins
8:13:18 PM: Finished restoring cached build plugins
8:13:18 PM: Attempting ruby version 2.7.2, read from environment
8:13:18 PM: Using ruby version 2.7.2
8:13:19 PM: Using PHP version 8.0
8:13:19 PM: No npm workspaces detected
8:13:19 PM: Started restoring cached node modules
8:13:19 PM: Finished restoring cached node modules
8:13:19 PM: Installing NPM modules using NPM version 8.11.0
8:13:23 PM: npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
8:13:26 PM: > postinstall
8:13:26 PM: > nuxt prepare
8:13:26 PM: [log] Nuxi 3.0.0
8:13:27 PM: [success] Types generated in .nuxt
8:13:27 PM: added 679 packages, and audited 680 packages in 8s
8:13:27 PM: 102 packages are looking for funding
8:13:27 PM:   run `npm fund` for details
8:13:27 PM: found 0 vulnerabilities
8:13:27 PM: NPM modules installed
8:13:27 PM: Creating package sha
8:13:28 PM: Started restoring cached go cache
8:13:28 PM: Finished restoring cached go cache
8:13:28 PM: Installing Go version 1.14.4 (requested 1.14.4)
8:13:31 PM: unset GOOS;
8:13:31 PM: unset GOARCH;
8:13:31 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.14.4.linux.amd64';
8:13:31 PM: export PATH="/opt/buildhome/.gimme/versions/go1.14.4.linux.amd64/bin:${PATH}";
8:13:31 PM: go version >&2;
8:13:31 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.14.4.linux.amd64.env"
8:13:31 PM: go version go1.14.4 linux/amd64
8:13:32 PM: Detected 1 framework(s)
8:13:32 PM: "nuxt" at version "3.0.0"
8:13:32 PM: Installing missing commands
8:13:32 PM: Verify run directory
8:13:33 PM: ​
8:13:33 PM: ────────────────────────────────────────────────────────────────
8:13:33 PM:   Netlify Build                                                 
8:13:33 PM: ────────────────────────────────────────────────────────────────
8:13:33 PM: ​
8:13:33 PM: ❯ Version
8:13:33 PM:   @netlify/build 28.4.0
8:13:33 PM: ​
8:13:33 PM: ❯ Flags
8:13:33 PM:   baseRelDir: true
8:13:33 PM:   buildId: 637de413196701000904872d
8:13:33 PM:   deployId: 637de413196701000904872f
8:13:33 PM: ​
8:13:33 PM: ❯ Current directory
8:13:33 PM:   /opt/build/repo
8:13:33 PM: ​
8:13:33 PM: ❯ Config file
8:13:33 PM:   /opt/build/repo/netlify.toml
8:13:33 PM: ​
8:13:33 PM: ❯ Context
8:13:33 PM:   production
8:13:33 PM: ​
8:13:33 PM: ────────────────────────────────────────────────────────────────
8:13:33 PM:   1. Build command from Netlify app                             
8:13:33 PM: ────────────────────────────────────────────────────────────────
8:13:33 PM: ​
8:13:33 PM: $ npm run generate
8:13:33 PM: > generate
8:13:33 PM: > nuxt generate
8:13:33 PM: [log] Nuxi 3.0.0
8:13:33 PM: [log] Nuxt 3.0.0 with Nitro 1.0.0
8:13:34 PM: [warn] Using experimental payload extraction for full-static output. You can opt-out by setting `experimental.payloadExtraction` to `false`.
8:13:37 PM: [info] Client built in 2739ms
8:13:37 PM: [info] Building server...
8:13:39 PM: [success] Server built in 1468ms
8:13:39 PM: [error] ENOENT: no such file or directory, mkdir '/opt/build/repo/dist'
8:13:39 PM: ​
8:13:39 PM: ────────────────────────────────────────────────────────────────
8:13:39 PM:   "build.command" failed                                        
8:13:39 PM: ────────────────────────────────────────────────────────────────
8:13:39 PM: ​
8:13:39 PM:   Error message
8:13:39 PM:   Command failed with exit code 1: npm run generate (https://ntl.fyi/exit-code-1)
8:13:39 PM: ​
8:13:39 PM:   Error location
8:13:39 PM:   In Build command from Netlify app:
8:13:39 PM:   npm run generate
8:13:39 PM: ​
8:13:39 PM:   Resolved config
8:13:39 PM:   build:
8:13:39 PM:     command: npm run generate
8:13:39 PM:     commandOrigin: ui
8:13:39 PM:     environment:
8:13:39 PM:       - API
8:13:39 PM:       - NETLIFY_GRAPH_TOKEN
8:13:39 PM:       - ONEGRAPH_AUTHLIFY_TOKEN
8:13:39 PM:     publish: /opt/build/repo/dist
8:13:39 PM:     publishOrigin: ui
8:13:39 PM:   headers:
8:13:39 PM:     - for: /*      values:        Access-Control-Allow-Origin: '*'  headersOrigin: configCaching artifacts
8:13:39 PM: Started saving node modules
8:13:39 PM: Finished saving node modules
8:13:39 PM: Started saving build plugins
8:13:39 PM: Finished saving build plugins
8:13:39 PM: Started saving pip cache
8:13:39 PM: Finished saving pip cache
8:13:39 PM: Started saving emacs cask dependencies
8:13:40 PM: Creating deploy upload records
8:13:39 PM: Finished saving emacs cask dependencies
8:13:39 PM: Started saving maven dependencies
8:13:39 PM: Finished saving maven dependencies
8:13:39 PM: Started saving boot dependencies
8:13:39 PM: Finished saving boot dependencies
8:13:39 PM: Started saving rust rustup cache
8:13:40 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
8:13:39 PM: Finished saving rust rustup cache
8:13:39 PM: Started saving go dependencies
8:13:39 PM: Finished saving go dependencies
8:13:40 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:13:40 PM: Failing build: Failed to build site
8:13:40 PM: Finished processing build request in 46.878493952s

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, your site URL, etc. Thanks!