Build script: non-zero exit code: 127

Please help me! Have tried various things like changing the build command, and build directory, but nothing seems to work.

Deploy Settings:

Build Command: CI=npm run build
Publish Directory: build/

Log:

9:01:56 PM: Error message
9:01:56 PM: Command failed with exit code 127: CI=npm run build (Search results for '"non-zero exit code: 127"' - Netlify Support Forums)
9:01:56 PM: ​
9:01:56 PM: Error location
9:01:56 PM: In Build command from Netlify app:
9:01:56 PM: CI=npm run build
9:01:56 PM: ​
9:01:56 PM: Resolved config
9:01:56 PM: build:
9:01:56 PM: command: CI=npm run build
9:01:56 PM: commandOrigin: ui
9:01:56 PM: publish: /opt/build/repo/build
9:01:56 PM: publishOrigin: ui

Does it have to do with that I’m using NPM?

Hey @codeyStein

Unfortunately the snippet of the deploy log provided omits the portion that would explain where the error stemmed from.

Can you post the full deploy log, or if logs are public the link to the latest failed log.

Alternatively check out these resources

Hi, sorry here’s the link of the full log: Netlify App

Thanks @codeyStein

The issue

1:01:56 PM: $ CI=npm run build
1:01:56 PM: bash: run: command not found

Setting CI to something other than true isn’t always necessary. npm run build should work in most instances. If you really wish to have CI set to false the command is

CI= npm run build

(note the space after the =)

That was it! Thanks so much, I can’t belive it was that simple haha

hey even after the changes in deploy setting i still got this error
7:02:07 PM: build-image version: 969defd95f3977f8de9cb1f48802a7e6f3d8c0b3 (noble-new-builds)
7:02:07 PM: buildbot version: 969defd95f3977f8de9cb1f48802a7e6f3d8c0b3
7:02:07 PM: Building without cache
7:02:07 PM: Starting to prepare the repo for build
7:02:07 PM: No cached dependencies found. Cloning fresh repo
7:02:07 PM: git clone --filter=blob:none https://github.com/magnanimous831/TimRideSafaris
7:02:08 PM: Preparing Git Reference refs/heads/main
7:02:15 PM: Installing dependencies
7:02:15 PM: mise ~/.config/mise/config.toml tools: python@3.14.3
7:02:15 PM: mise ~/.config/mise/config.toml tools: ruby@3.4.8
7:02:16 PM: mise ~/.config/mise/config.toml tools: go@1.26.2
7:02:16 PM: v24.18.0 is already installed.
7:02:16 PM: Now using node v24.18.0 (npm v11.16.0)
7:02:16 PM: Enabling Node.js Corepack
7:02:16 PM: No npm workspaces detected
7:02:16 PM: Installing npm packages using npm version 11.16.0
7:02:18 PM: added 6 packages, and removed 5 packages in 2s
7:02:18 PM: npm warn allow-scripts 3 packages have install scripts not yet covered by allowScripts:
7:02:18 PM: npm warn allow-scripts @swc/core@1.15.43 (install: (install scripts present))
7:02:18 PM: npm warn allow-scripts esbuild@0.25.12 (install: (install scripts present))
7:02:18 PM: npm warn allow-scripts esbuild@0.21.5 (install: (install scripts present))
7:02:18 PM: npm warn allow-scripts
7:02:18 PM: npm warn allow-scripts Run `npm approve-scripts --allow-scripts-pending` to review, or `npm approve-scripts ` to allow.
7:02:18 PM: npm packages installed
7:02:18 PM: Successfully installed dependencies
7:02:18 PM: Detected 1 framework(s)
7:02:18 PM: β€œvite” at version β€œ5.4.21”
7:02:19 PM: Starting build script
7:02:19 PM: Section completed: initializing
7:02:21 PM: ​
7:02:21 PM: Netlify Build
7:02:21 PM: ────────────────────────────────────────────────────────────────
7:02:21 PM: ​
7:02:21 PM: ❯ Version
7:02:21 PM: @netlify/build 36.1.2
7:02:21 PM: ​
7:02:21 PM: ❯ Flags
7:02:21 PM: accountId: 6a52472509a90ead667f3b2b
7:02:21 PM: baseRelDir: true
7:02:21 PM: buildId: 6a5268fed453917a9efd40fa
7:02:21 PM: deployId: 6a5268fed453917a9efd40fc
7:02:21 PM: ​
7:02:21 PM: ❯ Current directory
7:02:21 PM: /opt/build/repo
7:02:21 PM: ​
7:02:21 PM: ❯ Config file
7:02:21 PM: /opt/build/repo/netlify.toml
7:02:21 PM: ​
7:02:21 PM: ❯ Context
7:02:21 PM: production
7:02:21 PM: ​
7:02:21 PM: Build command from Netlify app
7:02:21 PM: ────────────────────────────────────────────────────────────────
7:02:21 PM: ​
7:02:21 PM: $ CI=npm run build
7:02:21 PM: bash: line 1: run: command not found
7:02:21 PM: ​
7:02:21 PM: β€œbuild.command” failed
7:02:21 PM: ────────────────────────────────────────────────────────────────
7:02:21 PM: ​
7:02:21 PM: Error message
7:02:21 PM: Command failed with exit code 127: CI=npm run build (Search results for '"non-zero exit code: 127"' - Netlify Support Forums)
7:02:21 PM: ​
7:02:21 PM: Error location
7:02:21 PM: In Build command from Netlify app:
7:02:21 PM: CI=npm run build
7:02:21 PM: ​
7:02:21 PM: Resolved config
7:02:21 PM: build:
7:02:21 PM: command: CI=npm run build
7:02:21 PM: commandOrigin: ui
7:02:21 PM: publish: /opt/build/repo/build
7:02:21 PM: publishOrigin: ui
7:02:21 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
7:02:22 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)
7:02:22 PM: Failing build: Failed to build site
7:02:22 PM: Finished processing build request in 15.022s