Command failed with exit code 254

  • we need to know your netlify site name. visionary-medovik-cf5828

1:40:30 AM: Build ready to start
1:40:32 AM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
1:40:32 AM: build-image tag: v4.8.0
1:40:32 AM: buildbot version: e552b142336b2b1222a93a4fd4cbed0019c77b46
1:40:32 AM: Building without cache
1:40:32 AM: Starting to prepare the repo for build
1:40:33 AM: No cached dependencies found. Cloning fresh repo
1:40:33 AM: git clone https://github.com/raboomar/aws
1:40:33 AM: Preparing Git Reference refs/heads/main
1:40:34 AM: Parsing package.json dependencies
1:40:34 AM: Starting build script
1:40:34 AM: Installing dependencies
1:40:34 AM: Python version set to 2.7
1:40:35 AM: v16.14.2 is already installed.
1:40:36 AM: Now using node v16.14.2 (npm v8.5.0)
1:40:36 AM: Started restoring cached build plugins
1:40:36 AM: Finished restoring cached build plugins
1:40:36 AM: Attempting ruby version 2.7.2, read from environment
1:40:37 AM: Using ruby version 2.7.2
1:40:37 AM: Using PHP version 8.0
1:40:37 AM: Started restoring cached go cache
1:40:37 AM: Finished restoring cached go cache
1:40:37 AM: go version go1.16.5 linux/amd64
1:40:37 AM: go version go1.16.5 linux/amd64
1:40:37 AM: Installing missing commands
1:40:37 AM: Verify run directory
1:40:39 AM: ​
1:40:39 AM: ────────────────────────────────────────────────────────────────
1:40:39 AM: Netlify Build
1:40:39 AM: ────────────────────────────────────────────────────────────────
1:40:39 AM: ​
1:40:39 AM: ❯ Version
1:40:39 AM: @netlify/build 26.5.2
1:40:39 AM: ​
1:40:39 AM: ❯ Flags
1:40:39 AM: baseRelDir: true
1:40:39 AM: buildId: 625510ce08e2c301be6fee46
1:40:39 AM: deployId: 625510ce08e2c301be6fee48
1:40:39 AM: ​
1:40:39 AM: ❯ Current directory
1:40:39 AM: /opt/build/repo
1:40:39 AM: ​
1:40:39 AM: ❯ Config file
1:40:39 AM: No config file was defined: using default values.
1:40:39 AM: ​
1:40:39 AM: ❯ Context
1:40:39 AM: production
1:40:39 AM: ​
1:40:39 AM: ────────────────────────────────────────────────────────────────
1:40:39 AM: 1. Build command from Netlify app
1:40:39 AM: ────────────────────────────────────────────────────────────────
1:40:39 AM: ​
1:40:39 AM: $ npm run build
1:40:39 AM: npm ERR! code ENOENT
1:40:39 AM: npm ERR! syscall open
1:40:39 AM: npm ERR! path /opt/build/repo/package.json
1:40:39 AM: npm ERR! errno -2
1:40:39 AM: npm ERR! enoent ENOENT: no such file or directory, open ‘/opt/build/repo/package.json’
1:40:39 AM: npm ERR! enoent This is related to npm not being able to find a file.
1:40:39 AM: npm ERR! enoent
1:40:39 AM: npm ERR! A complete log of this run can be found in:
1:40:39 AM: npm ERR! /opt/buildhome/.npm/_logs/2022-04-12T05_40_39_567Z-debug-0.log
1:40:39 AM: ​
1:40:39 AM: ────────────────────────────────────────────────────────────────
1:40:39 AM: “build.command” failed
1:40:39 AM: ────────────────────────────────────────────────────────────────
1:40:39 AM: ​
1:40:39 AM: Error message
1:40:39 AM: Command failed with exit code 254: npm run build (Search results for '"non-zero exit code: 254"' - Netlify Support Forums)
1:40:39 AM: ​
1:40:39 AM: Error location
1:40:39 AM: In Build command from Netlify app:
1:40:39 AM: npm run build
1:40:39 AM: ​
1:40:39 AM: Resolved config
1:40:39 AM: build:
1:40:41 AM: Creating deploy upload records
1:40:39 AM: command: npm run build
1:40:39 AM: commandOrigin: ui
1:40:39 AM: publish: /opt/build/repo/build
1:40:39 AM: publishOrigin: ui
1:40:40 AM: Caching artifacts
1:40:40 AM: Started saving build plugins
1:40:41 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)
1:40:40 AM: Finished saving build plugins
1:40:40 AM: Started saving pip cache
1:40:40 AM: Finished saving pip cache
1:40:40 AM: Started saving emacs cask dependencies
1:40:40 AM: Finished saving emacs cask dependencies
1:40:40 AM: Started saving maven dependencies
1:40:40 AM: Finished saving maven dependencies
1:40:40 AM: Started saving boot dependencies
1:40:40 AM: Finished saving boot dependencies
1:40:40 AM: Started saving rust rustup cache
1:40:40 AM: Finished saving rust rustup cache
1:40:40 AM: Started saving go dependencies
1:40:40 AM: Finished saving go dependencies
1:40:41 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:40:41 AM: Failing build: Failed to build site
1:40:41 AM: Finished processing build request in 9.058401776s

Hey @raboomar

Based on the above line it appears you are deploying from the root of the repository and there is no package.json file present.

Have you looked through this support guide?

You can find further support guides in

If you are unable to resolve the issue, can you provide the link to a public git repository.

1 Like