Build.command error

4:50:38 PM: Waiting for other deploys from your team to complete. Check the queue: Netlify App
4:50:39 PM: Build ready to start
4:50:40 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
4:50:40 PM: build-image tag: v4.8.0
4:50:40 PM: buildbot version: e552b142336b2b1222a93a4fd4cbed0019c77b46
4:50:40 PM: Fetching cached dependencies
4:50:41 PM: Failed to fetch cache, continuing with build
4:50:41 PM: Starting to prepare the repo for build
4:50:41 PM: No cached dependencies found. Cloning fresh repo
4:50:41 PM: git clone GitHub - MetaGamefi/Test
4:50:41 PM: Preparing Git Reference refs/heads/main
4:50:41 PM: Parsing package.json dependencies
4:50:42 PM: Starting build script
4:50:42 PM: Installing dependencies
4:50:42 PM: Python version set to 2.7
4:50:43 PM: v16.14.2 is already installed.
4:50:43 PM: Now using node v16.14.2 (npm v8.5.0)
4:50:43 PM: Started restoring cached build plugins
4:50:43 PM: Finished restoring cached build plugins
4:50:43 PM: Attempting ruby version 2.7.2, read from environment
4:50:44 PM: Using ruby version 2.7.2
4:50:45 PM: Using PHP version 8.0
4:50:45 PM: Started restoring cached go cache
4:50:45 PM: Finished restoring cached go cache
4:50:45 PM: go version go1.16.5 linux/amd64
4:50:45 PM: go version go1.16.5 linux/amd64
4:50:45 PM: Installing missing commands
4:50:45 PM: Verify run directory
4:50:46 PM: ​
4:50:46 PM: ────────────────────────────────────────────────────────────────
4:50:46 PM: Netlify Build
4:50:46 PM: ────────────────────────────────────────────────────────────────
4:50:46 PM: ​
4:50:46 PM: ❯ Version
4:50:46 PM: @netlify/build 26.5.2
4:50:46 PM: ​
4:50:46 PM: ❯ Flags
4:50:46 PM: baseRelDir: true
4:50:46 PM: buildId: 624b763e5a54434258296f21
4:50:46 PM: deployId: 624b763e5a54434258296f23
4:50:46 PM: ​
4:50:46 PM: ❯ Current directory
4:50:46 PM: /opt/build/repo
4:50:46 PM: ​
4:50:46 PM: ❯ Config file
4:50:46 PM: No config file was defined: using default values.
4:50:46 PM: ​
4:50:46 PM: ❯ Context
4:50:46 PM: production
4:50:46 PM: ​
4:50:46 PM: ────────────────────────────────────────────────────────────────
4:50:46 PM: 1. Build command from Netlify app
4:50:46 PM: ────────────────────────────────────────────────────────────────
4:50:46 PM: ​
4:50:46 PM: $ CI= npm run build
4:50:46 PM: npm ERR! code ENOENT
4:50:46 PM: npm ERR! syscall open
4:50:46 PM: npm ERR! path /opt/build/repo/package.json
4:50:46 PM: npm ERR! errno -2
4:50:46 PM: npm ERR! enoent ENOENT: no such file or directory, open β€˜/opt/build/repo/package.json’
4:50:46 PM: npm ERR! enoent This is related to npm not being able to find a file.
4:50:46 PM: npm ERR! enoent
4:50:46 PM: npm ERR! A complete log of this run can be found in:
4:50:46 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-04-04T22_50_46_510Z-debug-0.log
4:50:46 PM: ​
4:50:46 PM: ────────────────────────────────────────────────────────────────
4:50:46 PM: β€œbuild.command” failed
4:50:46 PM: ────────────────────────────────────────────────────────────────
4:50:46 PM: ​
4:50:46 PM: Error message
4:50:46 PM: Command failed with exit code 254: CI= npm run build (Search results for '"non-zero exit code: 254"' - Netlify Support Forums)
4:50:46 PM: ​
4:50:46 PM: Error location
4:50:46 PM: In Build command from Netlify app:
4:50:46 PM: CI= npm run build
4:50:46 PM: ​
4:50:46 PM: Resolved config
4:50:46 PM: build:
4:50:48 PM: Creating deploy upload records
4:50:46 PM: command: CI= npm run build
4:50:46 PM: commandOrigin: ui
4:50:46 PM: publish: /opt/build/repo/build
4:50:46 PM: publishOrigin: ui
4:50:47 PM: Caching artifacts
4:50:47 PM: Started saving build plugins
4:50:48 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)
4:50:47 PM: Finished saving build plugins
4:50:47 PM: Started saving pip cache
4:50:47 PM: Finished saving pip cache
4:50:47 PM: Started saving emacs cask dependencies
4:50:47 PM: Finished saving emacs cask dependencies
4:50:47 PM: Started saving maven dependencies
4:50:47 PM: Finished saving maven dependencies
4:50:47 PM: Started saving boot dependencies
4:50:47 PM: Finished saving boot dependencies
4:50:47 PM: Started saving rust rustup cache
4:50:47 PM: Finished saving rust rustup cache
4:50:47 PM: Started saving go dependencies
4:50:47 PM: Finished saving go dependencies
4:50:48 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:50:48 PM: Failing build: Failed to build site
4:50:48 PM: Finished processing build request in 7.67775213s

Repository link:

Any feedback or solutions would be greatly appreciated! I have tried several things.

Hey @Metagamefi

The NFT app you are looking to deploy is in a sub-directory. See point #2 of [Support Guide] Frequently encountered problems during builds along with with Base Directory section of the Monorepo documentation.

2 Likes