Build script returning Non-zero exit code 2

anything helps.
base directory is /
build command is npm run build
publish directory is /build
build site is https://skelebytes.netlify.app

12:04:46 AM: Build ready to start
12:04:48 AM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
12:04:48 AM: build-image tag: v4.8.0
12:04:48 AM: buildbot version: 29e546ddee264a16af472b38ccba15b350150213
12:04:48 AM: Building without cache
12:04:48 AM: Starting to prepare the repo for build
12:04:48 AM: No cached dependencies found. Cloning fresh repo
12:04:48 AM: git clone GitHub - Skelebytes/Skelebytes
12:04:49 AM: Preparing Git Reference refs/heads/main
12:04:49 AM: Parsing package.json dependencies
12:04:49 AM: Different build dir detected, going to use the one specified in the Netlify configuration file: ‘’ versus ‘/’ in the Netlify UI
12:04:50 AM: Starting build script
12:04:50 AM: Installing dependencies
12:04:50 AM: Python version set to 2.7
12:04:50 AM: Downloading and installing node v16.15.0…
12:04:51 AM: Downloading https://nodejs.org/dist/v16.15.0/node-v16.15.0-linux-x64.tar.xz
12:04:51 AM: Computing checksum with sha256sum
12:04:51 AM: Checksums matched!
12:04:53 AM: Now using node v16.15.0 (npm v8.5.5)
12:04:53 AM: Started restoring cached build plugins
12:04:53 AM: Finished restoring cached build plugins
12:04:54 AM: Attempting ruby version 2.7.2, read from environment
12:04:55 AM: Using ruby version 2.7.2
12:04:55 AM: Using PHP version 8.0
12:04:55 AM: Started restoring cached go cache
12:04:55 AM: Finished restoring cached go cache
12:04:55 AM: go version go1.16.5 linux/amd64
12:04:55 AM: go version go1.16.5 linux/amd64
12:04:55 AM: Installing missing commands
12:04:55 AM: Verify run directory
12:04:56 AM: ​
12:04:56 AM: ────────────────────────────────────────────────────────────────
12:04:56 AM: Netlify Build
12:04:56 AM: ────────────────────────────────────────────────────────────────
12:04:56 AM: ​
12:04:56 AM: ❯ Version
12:04:56 AM: @netlify/build 27.1.1
12:04:56 AM: ​
12:04:56 AM: ❯ Flags
12:04:56 AM: baseRelDir: true
12:04:56 AM: buildId: 6279e45e704f552fc41ad939
12:04:56 AM: deployId: 6279e45e704f552fc41ad93b
12:04:56 AM: ​
12:04:56 AM: ❯ Current directory
12:04:56 AM: /opt/build/repo
12:04:56 AM: ​
12:04:56 AM: ❯ Config file
12:04:56 AM: No config file was defined: using default values.
12:04:56 AM: ​
12:04:56 AM: ❯ Context
12:04:56 AM: production
12:04:56 AM: ​
12:04:56 AM: ────────────────────────────────────────────────────────────────
12:04:56 AM: 1. Build command from Netlify app
12:04:56 AM: ────────────────────────────────────────────────────────────────
12:04:56 AM: ​
12:04:56 AM: $ npm run build
12:04:56 AM: npm ERR! code ENOENT
12:04:56 AM: npm ERR! syscall open
12:04:56 AM: npm ERR! path /opt/build/repo/package.json
12:04:56 AM: npm ERR! errno -2
12:04:56 AM: npm ERR! enoent ENOENT: no such file or directory, open ‘/opt/build/repo/package.json’
12:04:56 AM: npm ERR! enoent This is related to npm not being able to find a file.
12:04:56 AM: npm ERR! enoent
12:04:56 AM: npm ERR! A complete log of this run can be found in:
12:04:56 AM: npm ERR! /opt/buildhome/.npm/_logs/2022-05-10T04_04_56_701Z-debug-0.log
12:04:56 AM: ​
12:04:56 AM: ────────────────────────────────────────────────────────────────
12:04:56 AM: “build.command” failed
12:04:56 AM: ────────────────────────────────────────────────────────────────
12:04:56 AM: ​
12:04:56 AM: Error message
12:04:56 AM: Command failed with exit code 254: npm run build (Search results for '"non-zero exit code: 254"' - Netlify Support Forums)
12:04:56 AM: ​
12:04:56 AM: Error location
12:04:56 AM: In Build command from Netlify app:
12:04:56 AM: npm run build
12:04:56 AM: ​
12:04:56 AM: Resolved config
12:04:56 AM: build:
12:04:56 AM: base: /opt/build/repo
12:04:56 AM: command: npm run build
12:04:56 AM: commandOrigin: ui
12:04:56 AM: publish: /opt/build/repo/build
12:04:56 AM: publishOrigin: ui
12:04:58 AM: Creating deploy upload records
12:04:57 AM: Caching artifacts
12:04:57 AM: Started saving build plugins
12:04:57 AM: Finished saving build plugins
12:04:57 AM: Started saving pip cache
12:04:57 AM: Finished saving pip cache
12:04:58 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)
12:04:57 AM: Started saving emacs cask dependencies
12:04:57 AM: Finished saving emacs cask dependencies
12:04:57 AM: Started saving maven dependencies
12:04:57 AM: Finished saving maven dependencies
12:04:57 AM: Started saving boot dependencies
12:04:57 AM: Finished saving boot dependencies
12:04:57 AM: Started saving rust rustup cache
12:04:57 AM: Finished saving rust rustup cache
12:04:57 AM: Started saving go dependencies
12:04:57 AM: Finished saving go dependencies
12:04:58 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:04:58 AM: Failing build: Failed to build site
12:04:59 AM: Finished processing build request in 10.52832447s

Hey @skelebyte

The Stripes NFT project you are trying to deploy (as with all threads regarding nft-minting-app-main of which there are numerous threads in these forums) resides in a sub directory.

Therefore, you need to set the base directory to nft-minting-app-main in order to build it (the publish directory is then set to nft-minting-app-main/build.)

If you have any further questions or issues, please don’t hesitate to reply.

hey there, while we’re talking I wanted to let you know ]that we ask all businesses in the NFT/Crypto space to speak with our sales and solutions team to purchase a contract to ensure that your site is on an appropriate account level for your usage.

You can reach them here:

Our High Performance Edge product is usually a necessity to be able to handle and administer successful launches.

We have seen many customers who have sites like these get attacked, and on our lower plans, such as Starter and Pro, these attacks tend to harm our main network. If that happens, we may not be able to keep your site online. Should an attack on your site harm our network or jeopardize the uptime of other customers, we will opt to take down your site. Further, many NFT/Crypto sites have generated bills for thousands of dollars worth of bandwidth used during launch, and we do take steps to ensure we are compensated for that use should that happen here too. Please make sure you are prepared to pay for eventual bandwidth charges which have been several thousands of dollars in the past.

If the above info changes whether or not you would like to proceed with hosting on Netlify, we encourage you to make the decision that is best for you, which might mean moving to a different provider, if the above seems unreasonable to you.