Website works fine on localhost but fails to build here

Wobble0

6:17:57 PM: Build ready to start
6:17:59 PM: build-image version: 195fbe127e5c374d9c4758652cb62e3b8936a395 (focal)
6:17:59 PM: build-image tag: v4.6.0
6:17:59 PM: buildbot version: 43c70c62bfed821cfaaabbb50f00238dd4bdd2d6
6:17:59 PM: Fetching cached dependencies
6:17:59 PM: Failed to fetch cache, continuing with build
6:17:59 PM: Starting to prepare the repo for build
6:17:59 PM: No cached dependencies found. Cloning fresh repo
6:17:59 PM: git clone https://github.com/Wobble0/SuperStars
6:18:00 PM: Preparing Git Reference refs/heads/main
6:18:01 PM: Parsing package.json dependencies
6:18:01 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: ‘’ versus ‘/’ in the Netlify UI
6:18:01 PM: Starting build script
6:18:01 PM: Installing dependencies
6:18:01 PM: Python version set to 2.7
6:18:02 PM: Downloading and installing node v16.14.2…
6:18:02 PM: Downloading https://nodejs.org/dist/v16.14.2/node-v16.14.2-linux-x64.tar.xz
6:18:02 PM: Computing checksum with sha256sum
6:18:02 PM: Checksums matched!
6:18:05 PM: Now using node v16.14.2 (npm v8.5.0)
6:18:05 PM: Started restoring cached build plugins
6:18:05 PM: Finished restoring cached build plugins
6:18:05 PM: Attempting ruby version 2.7.2, read from environment
6:18:06 PM: Using ruby version 2.7.2
6:18:06 PM: Using PHP version 8.0
6:18:06 PM: Started restoring cached go cache
6:18:06 PM: Finished restoring cached go cache
6:18:06 PM: go version go1.16.5 linux/amd64
6:18:06 PM: go version go1.16.5 linux/amd64
6:18:06 PM: Installing missing commands
6:18:06 PM: Verify run directory
6:18:07 PM: ​
6:18:07 PM: ────────────────────────────────────────────────────────────────
6:18:07 PM: Netlify Build
6:18:07 PM: ────────────────────────────────────────────────────────────────
6:18:07 PM: ​
6:18:07 PM: ❯ Version
6:18:07 PM: @netlify/build 26.5.1
6:18:07 PM: ​
6:18:07 PM: ❯ Flags
6:18:07 PM: baseRelDir: true
6:18:07 PM: buildId: 623b9c95bb04cb00b935f651
6:18:07 PM: deployId: 623b9c95bb04cb00b935f653
6:18:07 PM: ​
6:18:07 PM: ❯ Current directory
6:18:07 PM: /opt/build/repo
6:18:07 PM: ​
6:18:07 PM: ❯ Config file
6:18:07 PM: No config file was defined: using default values.
6:18:07 PM: ​
6:18:07 PM: ❯ Context
6:18:07 PM: production
6:18:07 PM: ​
6:18:07 PM: ────────────────────────────────────────────────────────────────
6:18:07 PM: 1. Build command from Netlify app
6:18:07 PM: ────────────────────────────────────────────────────────────────
6:18:07 PM: ​
6:18:07 PM: $ CI= npm run build
6:18:07 PM: npm ERR! code ENOENT
6:18:07 PM: npm ERR! syscall open
6:18:07 PM: npm ERR! path /opt/build/repo/package.json
6:18:07 PM: npm ERR! errno -2
6:18:07 PM: npm ERR! enoent ENOENT: no such file or directory, open ‘/opt/build/repo/package.json’
6:18:07 PM: npm ERR! enoent This is related to npm not being able to find a file.
6:18:07 PM: npm ERR! enoent
6:18:07 PM: npm ERR! A complete log of this run can be found in:
6:18:07 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-03-23T22_18_07_644Z-debug-0.log
6:18:07 PM: ​
6:18:07 PM: ────────────────────────────────────────────────────────────────
6:18:07 PM: “build.command” failed
6:18:07 PM: ────────────────────────────────────────────────────────────────
6:18:07 PM: ​
6:18:07 PM: Error message
6:18:07 PM: Command failed with exit code 254: CI= npm run build (Search results for '"non-zero exit code: 254"' - Netlify Support Forums)
6:18:07 PM: ​
6:18:07 PM: Error location
6:18:07 PM: In Build command from Netlify app:
6:18:07 PM: CI= npm run build
6:18:07 PM: ​
6:18:07 PM: Resolved config
6:18:07 PM: build:
6:18:07 PM: base: /opt/build/repo
6:18:07 PM: command: CI= npm run build
6:18:07 PM: commandOrigin: ui
6:18:07 PM: publish: /opt/build/repo/build
6:18:07 PM: publishOrigin: ui
6:18:08 PM: Caching artifacts
6:18:08 PM: Started saving build plugins
6:18:08 PM: Finished saving build plugins
6:18:08 PM: Started saving pip cache
6:18:09 PM: Creating deploy upload records
6:18:08 PM: Finished saving pip cache
6:18:08 PM: Started saving emacs cask dependencies
6:18:08 PM: Finished saving emacs cask dependencies
6:18:08 PM: Started saving maven dependencies
6:18:08 PM: Finished saving maven dependencies
6:18:08 PM: Started saving boot dependencies
6:18:09 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
6:18:08 PM: Finished saving boot dependencies
6:18:08 PM: Started saving rust rustup cache
6:18:08 PM: Finished saving rust rustup cache
6:18:08 PM: Started saving go dependencies
6:18:08 PM: Finished saving go dependencies
6:18:09 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:18:09 PM: Failing build: Failed to build site
6:18:10 PM: Finished processing build request in 11.00771482s

Hey @Wobble0

There is no package.json file in the root of your repository. It is in nft-minting-app-main. You need to follow the Build from a subdirectory or monorepo documentation and set the base directory to nft-minting-app-main.

Do search nft-minting-app-main on these forums as there are several threads related to trouble deploying this Stripes NFT app.

Please read over the follow post from @perry relating to the deployment of NFT/Crpyto apps to Netlify

1 Like