Hi all, I’m trying to deploy a payload cms build to netlify as an alternative to sanity. Here are the build instructions according to Payload documentation: In order for Payload to run, it requires both the server code and the built admin panel. These will be the dist
and build
directories by default. If you’ve used create-payload-app
to create your project, executing the build
npm script will build both and output these directories.
I’m using the default build configuration and it works locally.
This is my build log:
4:36:04 AM: build-image version: f0de447600c93198b2eef6ed4ec8e338d9c0582c (focal)
4:36:04 AM: buildbot version: f0de447600c93198b2eef6ed4ec8e338d9c0582c
4:36:04 AM: Fetching cached dependencies
4:36:04 AM: Failed to fetch cache, continuing with build
4:36:04 AM: Starting to prepare the repo for build
4:36:04 AM: No cached dependencies found. Cloning fresh repo
4:36:04 AM: git clone --filter=blob:none https://github.com/tyler-gits-me/zackFencePayload
4:36:04 AM: Preparing Git Reference refs/heads/master
4:36:05 AM: Parsing package.json dependencies
4:36:06 AM: Starting to install dependencies
4:36:06 AM: Python version set to 3.8
4:36:06 AM: Started restoring cached go cache
4:36:06 AM: Finished restoring cached go cache
4:36:06 AM: Installing Go version 1.19.5 (requested 1.19.5)
4:36:11 AM: go version go1.19.5 linux/amd64
4:36:12 AM: v16.20.0 is already installed.
4:36:12 AM: Now using node v16.20.0 (npm v8.19.4)
4:36:12 AM: Enabling Node.js Corepack
4:36:12 AM: Started restoring cached build plugins
4:36:12 AM: Finished restoring cached build plugins
4:36:12 AM: WARNING: The environment variable ‘NODE_ENV’ is set to ‘production’. Any ‘devDependencies’ in package.json will not be installed
4:36:12 AM: Started restoring cached corepack dependencies
4:36:12 AM: Finished restoring cached corepack dependencies
4:36:12 AM: No npm workspaces detected
4:36:12 AM: Started restoring cached node modules
4:36:12 AM: Finished restoring cached node modules
4:36:12 AM: Installing npm packages using npm version 8.19.4
4:36:15 AM: 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: Array.prototype.sort() - JavaScript | MDN
4:36:17 AM: npm WARN deprecated express-graphql@0.12.0: This package is no longer maintained. We recommend using graphql-http
instead. Please consult the migration document GitHub - graphql/graphql-http: Simple, pluggable, zero-dependency, GraphQL over HTTP spec compliant server, client and audit suite..
4:36:25 AM: added 798 packages, and audited 799 packages in 13s
4:36:25 AM: 159 packages are looking for funding
4:36:25 AM: run npm fund
for details
4:36:25 AM: found 0 vulnerabilities
4:36:25 AM: npm packages installed
4:36:26 AM: Using PHP version 8.0
4:36:27 AM: Attempting Ruby version 2.7.2, read from environment
4:36:28 AM: Using Ruby version 2.7.2
4:36:28 AM: Install dependencies script success
4:36:28 AM: Starting build script
4:36:28 AM: Using stage install dependencies
4:36:29 AM: Detected 0 framework(s)
4:36:29 AM: Section completed: initializing
4:36:30 AM:
4:36:30 AM: Netlify Build
4:36:30 AM: ────────────────────────────────────────────────────────────────
4:36:30 AM:
4:36:30 AM: ❯ Version
4:36:30 AM: @netlify/build 29.9.0
4:36:30 AM:
4:36:30 AM: ❯ Flags
4:36:30 AM: baseRelDir: true
4:36:30 AM: buildId: 642e845233010300087cb700
4:36:30 AM: deployId: 642e845233010300087cb702
4:36:30 AM:
4:36:30 AM: ❯ Current directory
4:36:30 AM: /opt/build/repo
4:36:30 AM:
4:36:30 AM: ❯ Config file
4:36:30 AM: No config file was defined: using default values.
4:36:30 AM:
4:36:30 AM: ❯ Context
4:36:30 AM: production
4:36:30 AM:
4:36:30 AM: 1. Build command from Netlify app
4:36:30 AM: ────────────────────────────────────────────────────────────────
4:36:30 AM:
4:36:30 AM: $ npm run build
4:36:30 AM: > zack-fence-payload@1.0.0 build
4:36:30 AM: > npm run copyfiles && npm run build:payload && npm run build:server
4:36:30 AM: > zack-fence-payload@1.0.0 copyfiles
4:36:30 AM: > copyfiles -u 1 “src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png}” dist/
4:36:30 AM: sh: 1: copyfiles: not found
4:36:30 AM:
4:36:30 AM: “build.command” failed
4:36:30 AM: ────────────────────────────────────────────────────────────────
4:36:30 AM:
4:36:30 AM: Error message
4:36:30 AM: Command failed with exit code 127: npm run build (Search results for '"non-zero exit code: 127"' - Netlify Support Forums)
4:36:30 AM:
4:36:30 AM: Error location
4:36:30 AM: In Build command from Netlify app:
4:36:30 AM: npm run build
4:36:30 AM:
4:36:30 AM: Resolved config
4:36:32 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)
4:36:30 AM: build:
4:36:30 AM: command: npm run build
4:36:30 AM: commandOrigin: ui
4:36:30 AM: environment:
4:36:30 AM: - MONGODB_URI
4:36:30 AM: - NODE_ENV
4:36:30 AM: - PAYLOAD_SECRET
4:36:30 AM: publish: /opt/build/repo/dist
4:36:30 AM: publishOrigin: ui
4:36:31 AM: Caching artifacts
4:36:31 AM: Started saving node modules
4:36:31 AM: Finished saving node modules
4:36:31 AM: Started saving build plugins
4:36:31 AM: Finished saving build plugins
4:36:31 AM: Started saving corepack cache
4:36:31 AM: Finished saving corepack cache
4:36:31 AM: Started saving pip cache
4:36:31 AM: Finished saving pip cache
4:36:31 AM: Started saving emacs cask dependencies
4:36:31 AM: Finished saving emacs cask dependencies
4:36:31 AM: Started saving maven dependencies
4:36:31 AM: Finished saving maven dependencies
4:36:31 AM: Started saving boot dependencies
4:36:31 AM: Finished saving boot dependencies
4:36:31 AM: Started saving rust rustup cache
4:36:31 AM: Finished saving rust rustup cache
4:36:31 AM: Started saving go dependencies
4:36:31 AM: Finished saving go dependencies
4:36:32 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:36:32 AM: Failing build: Failed to build site
4:36:32 AM: Finished processing build request in 28.236s
I’ve attempted setting my build directory to dist, /dist, build, etc. I’ve had it deployed and built to netifly before but I forget how and it gave me a page could not be displayed error. I’ve been messing with differert cms options for a few days now and forget if I’ve had a working deploy on netlify or not.
I super appreciate any help or guidance on this, I’m stumped.