Publish directory not found

Hello, I have a similar problem, I checked the build command and it seems correct to me.

The logs is this:

6:51:34 PM: Build ready to start
6:51:36 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
6:51:36 PM: build-image tag: v4.10.1
6:51:36 PM: buildbot version: 1c362ef848ac5e35535bdb572ebca893db28c8a0
6:51:36 PM: Building without cache
6:51:36 PM: Starting to prepare the repo for build
6:51:36 PM: No cached dependencies found. Cloning fresh repo
6:51:36 PM: git clone git@gitlab.com:visideadoc/visidea-docs
6:51:37 PM: Preparing Git Reference refs/heads/main
6:51:38 PM: Parsing package.json dependencies
6:51:39 PM: Starting build script
6:51:39 PM: Installing dependencies
6:51:39 PM: Python version set to 2.7
6:51:39 PM: Downloading and installing node v16.17.1...
6:51:39 PM: Downloading https://nodejs.org/dist/v16.17.1/node-v16.17.1-linux-x64.tar.xz...
6:51:40 PM: Computing checksum with sha256sum
6:51:40 PM: Checksums matched!
6:51:42 PM: Now using node v16.17.1 (npm v8.15.0)
6:51:42 PM: Started restoring cached build plugins
6:51:42 PM: Finished restoring cached build plugins
6:51:42 PM: Attempting ruby version 2.7.2, read from environment
6:51:42 PM: Using ruby version 2.7.2
6:51:43 PM: Using PHP version 8.0
6:51:43 PM: No npm workspaces detected
6:51:43 PM: Started restoring cached node modules
6:51:43 PM: Finished restoring cached node modules
6:51:43 PM: Installing NPM modules using NPM version 8.15.0
6:51:43 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
6:51:43 PM: npm WARN config location in the cache, and they are managed by
6:51:43 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
6:51:43 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
6:51:43 PM: npm WARN config location in the cache, and they are managed by
6:51:43 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
6:51:46 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
6:51:56 PM: added 1080 packages, and audited 1081 packages in 13s
6:51:56 PM: 197 packages are looking for funding
6:51:56 PM:   run `npm fund` for details
6:51:56 PM: 21 vulnerabilities (8 moderate, 13 high)
6:51:56 PM: To address issues that do not require attention, run:
6:51:56 PM:   npm audit fix
6:51:56 PM: Some issues need review, and may require choosing
6:51:56 PM: a different dependency.
6:51:56 PM: Run `npm audit` for details.
6:51:56 PM: NPM modules installed
6:51:57 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
6:51:57 PM: npm WARN config location in the cache, and they are managed by
6:51:57 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
6:51:57 PM: Started restoring cached go cache
6:51:57 PM: Finished restoring cached go cache
6:51:57 PM: Installing Go version 1.17 (requested 1.17)
6:52:03 PM: unset GOOS;
6:52:03 PM: unset GOARCH;
6:52:03 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
6:52:03 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
6:52:03 PM: go version >&2;
6:52:03 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
6:52:03 PM: go version go1.17 linux/amd64
6:52:03 PM: Installing missing commands
6:52:03 PM: Verify run directory
6:52:04 PM: ​
6:52:04 PM: ────────────────────────────────────────────────────────────────
6:52:04 PM:   Netlify Build                                                 
6:52:04 PM: ────────────────────────────────────────────────────────────────
6:52:04 PM: ​
6:52:04 PM: ❯ Version
6:52:04 PM:   @netlify/build 27.18.4
6:52:04 PM: ​
6:52:04 PM: ❯ Flags
6:52:04 PM:   baseRelDir: true
6:52:04 PM:   buildId: 63332a169bb579008d218f84
6:52:04 PM:   deployId: 63332a169bb579008d218f86
6:52:04 PM: ​
6:52:04 PM: ❯ Current directory
6:52:04 PM:   /opt/build/repo
6:52:04 PM: ​
6:52:04 PM: ❯ Config file
6:52:04 PM:   No config file was defined: using default values.
6:52:04 PM: ​
6:52:04 PM: ❯ Context
6:52:04 PM:   production
6:52:04 PM: ​
6:52:04 PM: ────────────────────────────────────────────────────────────────
6:52:04 PM:   1. Build command from Netlify app                             
6:52:04 PM: ────────────────────────────────────────────────────────────────
6:52:04 PM: ​
6:52:04 PM: $ npm run build
6:52:05 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
6:52:05 PM: npm WARN config location in the cache, and they are managed by
6:52:05 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
6:52:05 PM: > visidea-docs@1.0.0 build
6:52:05 PM: > docusaurus build
6:52:06 PM: [INFO] [en] Creating an optimized production build...
6:52:07 PM: [info] [webpackbar] Compiling Client
6:52:07 PM: [info] [webpackbar] Compiling Server
6:52:23 PM: [success] [webpackbar] Client: Compiled successfully in 16.72s
6:52:25 PM: [success] [webpackbar] Server: Compiled successfully in 18.53s
6:52:31 PM: [SUCCESS] Generated static files in "build".
6:52:31 PM: [INFO] Use `npm run serve` command to test your build locally.
6:52:31 PM: ​
6:52:31 PM: (build.command completed in 26.1s)
6:52:31 PM: ​
6:52:31 PM: ────────────────────────────────────────────────────────────────
6:52:31 PM:   2. Deploy site                                                
6:52:31 PM: ────────────────────────────────────────────────────────────────
6:52:31 PM: ​
6:52:31 PM: ​
6:52:31 PM: ────────────────────────────────────────────────────────────────
6:52:31 PM:   Configuration error                                           
6:52:31 PM: ────────────────────────────────────────────────────────────────
6:52:31 PM: ​
6:52:31 PM:   Error message
6:52:31 PM:   Deploy did not succeed: Deploy directory 'website/build' does not exist
6:52:31 PM: ​
6:52:31 PM:   Resolved config
6:52:31 PM:   build:
6:52:31 PM:     command: npm run build
6:52:31 PM:     commandOrigin: ui
6:52:31 PM:     publish: /opt/build/repo/website/build
6:52:31 PM:     publishOrigin: ui
6:52:31 PM: Caching artifacts
6:52:31 PM: Started saving node modules
6:52:31 PM: Finished saving node modules
6:52:31 PM: Started saving build plugins
6:52:31 PM: Finished saving build plugins
6:52:31 PM: Started saving pip cache
6:52:31 PM: Finished saving pip cache
6:52:31 PM: Started saving emacs cask dependencies
6:52:31 PM: Finished saving emacs cask dependencies
6:52:31 PM: Started saving maven dependencies
6:52:31 PM: Finished saving maven dependencies
6:52:31 PM: Started saving boot dependencies
6:52:31 PM: Finished saving boot dependencies
6:52:31 PM: Started saving rust rustup cache
6:52:31 PM: Finished saving rust rustup cache
6:52:31 PM: Started saving go dependencies
6:52:31 PM: Finished saving go dependencies
6:52:32 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:52:32 PM: Creating deploy upload records
6:52:32 PM: Failing build: Failed to build site
6:52:32 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
6:52:32 PM: Finished processing build request in 56.616727655s

Hi, @visideadoc. I have move this to a new topic because the error you are getting is not caused by the same issue as found in the topic where you added this post originally.

Hi @visideadoc

From the error message here, you are setting an incorrect publish directory. As the repository you are deploying from is private, I can’t offer any more than that.

1 Like

Echoing @coelmay, it will be hard to debug this further with the repo being private. Can you create a reproduction for us?

2 Likes

Hi @coelmay, I didn’t read well the Docusuaus documentation. I had to change the Publish directory in the Netlify configuration to β€œbuild”.
Thanks for your help!

2 Likes

@hillary solved, the problem was in the publish directory setting.
Thanks for your help!

1 Like

Thanks for coming back and letting us know! Glad everything is working now!