Hi, so I’ve been using Netlify for a bit and always deployed with only react; I just tried creating an express server for the program and deploying to netlify; however when i set my publish directory to /plug-website/build (plug-website containing the src and public folders and where the build folder should be), i get this build log:
5:47:18 AM: build-image version: 4c0c1cadee6a31c9bb8d824514030009c4c05c6a (focal)
5:47:18 AM: build-image tag: v4.15.0
5:47:18 AM: buildbot version: cc0c986a947e274d444f48f63f797a5d01f2a89a
5:47:18 AM: Fetching cached dependencies
5:47:18 AM: Starting to download cache of 186.3MB
5:47:19 AM: Finished downloading cache in 1.569502338s
5:47:19 AM: Starting to extract cache
5:47:21 AM: Finished extracting cache in 1.241684162s
5:47:21 AM: Finished fetching cache in 2.848978136s
5:47:21 AM: Starting to prepare the repo for build
5:47:21 AM: Preparing Git Reference refs/heads/main
5:47:24 AM: Parsing package.json dependencies
5:47:25 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘plug-website/build’ versus ‘/plug-website/build’ in the Netlify UI
5:47:25 AM: Different functions path detected, going to use the one specified in the Netlify configuration file: ‘functions’ versus ‘’ in the Netlify UI
5:47:25 AM: Different build command detected, going to use the one specified in the Netlify configuration file: ‘npm install && npm run build’ versus ‘npm run build’ in the Netlify UI
5:47:25 AM: Section completed: initializing
5:47:25 AM: Starting build script
5:47:25 AM: Installing dependencies
5:47:25 AM: Python version set to 2.7
5:47:26 AM: Started restoring cached node version
5:47:26 AM: Finished restoring cached node version
5:47:27 AM: v16.18.1 is already installed.
5:47:27 AM: Now using node v16.18.1 (npm v8.19.2)
5:47:27 AM: Enabling node corepack
5:47:27 AM: Started restoring cached build plugins
5:47:27 AM: Finished restoring cached build plugins
5:47:27 AM: Attempting ruby version 2.7.2, read from environment
5:47:28 AM: Using ruby version 2.7.2
5:47:28 AM: Using PHP version 8.0
5:47:28 AM: No npm workspaces detected
5:47:28 AM: Started restoring cached node modules
5:47:28 AM: Finished restoring cached node modules
5:47:29 AM: Started restoring cached go cache
5:47:29 AM: Finished restoring cached go cache
5:47:29 AM: Installing Go version 1.17 (requested 1.17)
5:47:33 AM: unset GOOS;
5:47:33 AM: unset GOARCH;
5:47:33 AM: export GOROOT=‘/opt/buildhome/.gimme/versions/go1.17.linux.amd64’;
5:47:33 AM: export PATH=“/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}”;
5:47:33 AM: go version >&2;
5:47:33 AM: export GIMME_ENV=“/opt/buildhome/.gimme/env/go1.17.linux.amd64.env”
5:47:33 AM: go version go1.17 linux/amd64
5:47:33 AM: Detected 0 framework(s)
5:47:33 AM: Installing missing commands
5:47:33 AM: Verify run directory
5:47:35 AM:
5:47:35 AM: ────────────────────────────────────────────────────────────────
5:47:35 AM: Netlify Build
5:47:35 AM: ────────────────────────────────────────────────────────────────
5:47:35 AM:
5:47:35 AM: ❯ Version
5:47:35 AM: @netlify/build 29.0.1
5:47:35 AM:
5:47:35 AM: ❯ Flags
5:47:35 AM: baseRelDir: true
5:47:35 AM: buildId: 6391eae4dc3b7b00081e941b
5:47:35 AM: deployId: 6391eae4dc3b7b00081e941d
5:47:35 AM:
5:47:35 AM: ❯ Current directory
5:47:35 AM: /opt/build/repo
5:47:35 AM:
5:47:35 AM: ❯ Config file
5:47:35 AM: /opt/build/repo/netlify.toml
5:47:35 AM:
5:47:35 AM: ❯ Context
5:47:35 AM: production
5:47:35 AM:
5:47:35 AM: ────────────────────────────────────────────────────────────────
5:47:35 AM: 1. build.command from netlify.toml
5:47:35 AM: ────────────────────────────────────────────────────────────────
5:47:35 AM:
5:47:35 AM: $ npm install && npm run build
5:47:37 AM: up to date, audited 644 packages in 2s
5:47:37 AM: 35 packages are looking for funding
5:47:37 AM: run npm fund
for details
5:47:37 AM: 5 high severity vulnerabilities
5:47:37 AM: To address all issues, run:
5:47:37 AM: npm audit fix
5:47:37 AM: Run npm audit
for details.
5:47:37 AM: > new-plug-vancouver-website@1.0.0 build
5:47:37 AM: > netlify-lambda build server
5:47:37 AM: netlify-lambda: Building functions
5:47:41 AM: Hash: 60b5e0a2df2dffebf1c6
5:47:41 AM: Version: webpack 4.46.0
5:47:41 AM: Time: 3099ms
5:47:41 AM: Built at: 12/08/2022 1:47:41 PM
5:47:41 AM: Asset Size Chunks Chunk Names
5:47:41 AM: server.js 680 KiB 0 [emitted] server
5:47:41 AM: Entrypoint server = server.js
5:47:41 AM: [0] ./node_modules/stripe/lib/StripeResource.js 18.8 KiB {0} [built]
5:47:41 AM: [1] external “path” 42 bytes {0} [built]
5:47:41 AM: [3] ./node_modules/depd/index.js 10.7 KiB {0} [built]
5:47:41 AM: [4] ./node_modules/stripe/lib/utils.js 10.8 KiB {0} [built]
5:47:41 AM: [6] external “fs” 42 bytes {0} [built]
5:47:41 AM: [15] ./node_modules/stripe/lib/Error.js 4.68 KiB {0} [built]
5:47:41 AM: [16] external “events” 42 bytes {0} [built]
5:47:41 AM: [20] ./node_modules/stripe/lib/net/HttpClient.js 1.58 KiB {0} [built]
5:47:41 AM: [34] ./node_modules/stripe/lib/crypto/CryptoProvider.js 1.42 KiB {0} [built]
5:47:41 AM: [46] ./node_modules/body-parser/index.js 2.62 KiB {0} [built]
5:47:41 AM: [67] ./server.js 2.22 KiB {0} [built]
5:47:41 AM: [68] ./node_modules/dotenv/lib/main.js 2.72 KiB {0} [built]
5:47:41 AM: [71] ./node_modules/stripe/lib/stripe.js 11.4 KiB {0} [built]
5:47:41 AM: [181] ./node_modules/express/index.js 224 bytes {0} [built]
5:47:41 AM: [243] ./node_modules/serverless-http/serverless-http.js 659 bytes {0} [built]
5:47:41 AM: + 245 hidden modules
5:47:41 AM: WARNING in ./node_modules/express/lib/view.js 81:13-25
5:47:41 AM: Critical dependency: the request of a dependency is an expression
5:47:41 AM: @ ./node_modules/express/lib/application.js
5:47:41 AM: @ ./node_modules/express/lib/express.js
5:47:41 AM: @ ./node_modules/express/index.js
5:47:41 AM: @ ./server.js
5:47:41 AM:
5:47:41 AM: (build.command completed in 5.7s)
5:47:41 AM:
5:47:41 AM: ────────────────────────────────────────────────────────────────
5:47:41 AM: 2. Functions bundling
5:47:41 AM: ────────────────────────────────────────────────────────────────
5:47:41 AM:
5:47:41 AM: Packaging Functions from functions directory:
5:47:41 AM: - aws-serverless.js
5:47:41 AM: - server.js
5:47:41 AM:
5:47:42 AM:
5:47:42 AM: Creating deploy upload records
5:47:42 AM: (Functions bundling completed in 1s)
5:47:42 AM:
5:47:42 AM: ────────────────────────────────────────────────────────────────
5:47:42 AM: 3. Deploy site
5:47:42 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
5:47:42 AM: ────────────────────────────────────────────────────────────────
5:47:42 AM:
5:47:42 AM: Section completed: deploying
5:47:42 AM:
5:47:42 AM: ────────────────────────────────────────────────────────────────
5:47:42 AM: Configuration error
5:47:42 AM: ────────────────────────────────────────────────────────────────
5:47:42 AM:
5:47:42 AM: Error message
5:47:42 AM: Deploy did not succeed: Deploy directory ‘plug-website/build’ does not exist
5:47:42 AM:
5:47:42 AM: Resolved config
5:47:42 AM: build:
5:47:42 AM: command: npm install && npm run build
5:47:42 AM: commandOrigin: config
5:47:42 AM: environment:
5:47:42 AM: - CI
5:47:42 AM: - NETLIFY_GRAPH_TOKEN
5:47:42 AM: - ONEGRAPH_AUTHLIFY_TOKEN
5:47:42 AM: publish: /opt/build/repo/plug-website/build
5:47:42 AM: publishOrigin: ui
5:47:42 AM: functionsDirectory: /opt/build/repo/functions
5:47:42 AM: redirects:
5:47:42 AM: - from: /*
status: 200
to: /index.html
redirectsOrigin: config
Caching artifacts
5:47:42 AM: Started saving node modules
5:47:42 AM: Finished saving node modules
5:47:42 AM: Started saving build plugins
5:47:42 AM: Finished saving build plugins
5:47:42 AM: Started saving pip cache
5:47:42 AM: Finished saving pip cache
5:47:42 AM: Started saving emacs cask dependencies
5:47:42 AM: Finished saving emacs cask dependencies
5:47:42 AM: Started saving maven dependencies
5:47:42 AM: Finished saving maven dependencies
5:47:42 AM: Started saving boot dependencies
5:47:42 AM: Finished saving boot dependencies
5:47:42 AM: Started saving rust rustup cache
5:47:42 AM: Finished saving rust rustup cache
5:47:42 AM: Started saving go dependencies
5:47:42 AM: Finished saving go dependencies
5:47:42 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:47:42 AM: Failing build: Failed to build site
5:47:43 AM: Finished processing build request in 24.822711054s
and if i set it as /plug-website/public, i just get the blank HTML file with only the index.html without any renders. what should i do?