I got the error “build. command” failed. I added the command CI= npm run build and still, the error continues.
My application is in React.js, I don’t know what else to do, and I am waiting for your help.
Thanks in advance.
12:08:28 AM: build-image version: c1f0e3189beff44ebec7048bf7ab2e75cb09660b (focal)
12:08:28 AM: buildbot version: c1f0e3189beff44ebec7048bf7ab2e75cb09660b
12:08:28 AM: Building without cache
12:08:28 AM: Starting to prepare the repo for build
12:08:28 AM: No cached dependencies found. Cloning fresh repo
12:08:28 AM: git clone --filter=blob:none https://github.com/NatsukiSh/portfolio
12:08:29 AM: Preparing Git Reference refs/heads/main
12:08:29 AM: Parsing package.json dependencies
12:08:30 AM: Starting build script
12:08:30 AM: Installing dependencies
12:08:30 AM: Python version set to 2.7
12:08:31 AM: v16.19.1 is already installed.
12:08:31 AM: Now using node v16.19.1 (npm v8.19.3)
12:08:31 AM: Enabling Node.js Corepack
12:08:31 AM: Started restoring cached build plugins
12:08:31 AM: Finished restoring cached build plugins
12:08:31 AM: Attempting Ruby version 2.7.2, read from environment
12:08:32 AM: Using Ruby version 2.7.2
12:08:32 AM: Using PHP version 8.0
12:08:32 AM: Started restoring cached corepack dependencies
12:08:32 AM: Finished restoring cached corepack dependencies
12:08:32 AM: No npm workspaces detected
12:08:32 AM: Started restoring cached node modules
12:08:32 AM: Finished restoring cached node modules
12:08:32 AM: Installing npm packages using npm version 8.19.3
12:08:36 AM: npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
12:08:36 AM: npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
12:08:36 AM: npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
12:08:38 AM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
12:08:42 AM: added 1476 packages, and audited 1477 packages in 10s
12:08:42 AM: 231 packages are looking for funding
12:08:42 AM: run `npm fund` for details
12:08:42 AM: 6 high severity vulnerabilities
12:08:42 AM: To address all issues (including breaking changes), run:
12:08:42 AM: npm audit fix --force
12:08:42 AM: Run `npm audit` for details.
12:08:42 AM: npm packages installed
12:08:43 AM: Started restoring cached go cache
12:08:43 AM: Finished restoring cached go cache
12:08:43 AM: go version go1.19.6 linux/amd64
12:08:43 AM: Detected 1 framework(s)
12:08:43 AM: "create-react-app" at version "5.0.1"
12:08:43 AM: Section completed: initializing
12:08:44 AM:
12:08:44 AM: Netlify Build
12:08:44 AM: ────────────────────────────────────────────────────────────────
12:08:44 AM:
12:08:44 AM: ❯ Version
12:08:44 AM: @netlify/build 29.5.8
12:08:44 AM:
12:08:44 AM: ❯ Flags
12:08:44 AM: baseRelDir: true
12:08:44 AM: buildId: 6403cf6bf041a315da2021d7
12:08:44 AM: deployId: 6403cf6bf041a315da2021d9
12:08:44 AM:
12:08:44 AM: ❯ Current directory
12:08:44 AM: /opt/build/repo
12:08:44 AM:
12:08:44 AM: ❯ Config file
12:08:44 AM: No config file was defined: using default values.
12:08:44 AM:
12:08:44 AM: ❯ Context
12:08:44 AM: production
12:08:44 AM:
12:08:44 AM: 1. Build command from Netlify app
12:08:44 AM: ────────────────────────────────────────────────────────────────
12:08:44 AM:
12:08:44 AM: $ CI=npm run build
12:08:44 AM: bash: run: command not found
12:08:44 AM:
12:08:44 AM: "build.command" failed
12:08:44 AM: ────────────────────────────────────────────────────────────────
12:08:44 AM:
12:08:44 AM: Error message
12:08:44 AM: Command failed with exit code 127: CI=npm run build
12:08:45 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2
12:08:44 AM:
12:08:44 AM: Error location
12:08:44 AM: In Build command from Netlify app:
12:08:44 AM: CI=npm run build
12:08:44 AM:
12:08:44 AM: Resolved config
12:08:44 AM: build:
12:08:44 AM: command: CI=npm run build
12:08:44 AM: commandOrigin: ui
12:08:44 AM: publish: /opt/build/repo/build
12:08:44 AM: publishOrigin: ui
12:08:45 AM: Caching artifacts
12:08:45 AM: Started saving node modules
12:08:45 AM: Finished saving node modules
12:08:45 AM: Started saving build plugins
12:08:45 AM: Finished saving build plugins
12:08:45 AM: Started saving corepack cache
12:08:45 AM: Finished saving corepack cache
12:08:45 AM: Started saving pip cache
12:08:45 AM: Finished saving pip cache
12:08:45 AM: Started saving emacs cask dependencies
12:08:45 AM: Finished saving emacs cask dependencies
12:08:45 AM: Started saving maven dependencies
12:08:45 AM: Finished saving maven dependencies
12:08:45 AM: Started saving boot dependencies
12:08:45 AM: Finished saving boot dependencies
12:08:45 AM: Started saving rust rustup cache
12:08:45 AM: Finished saving rust rustup cache
12:08:45 AM: Started saving go dependencies
12:08:45 AM: Finished saving go dependencies
12:08:45 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:08:45 AM: Failing build: Failed to build site
12:08:46 AM: Finished processing build request in 17.365s
Natsuki:
CI=npm run build
There needs to be a space here. It should be CI= npm run build
.
Hi hrishikesh,
Thank you for helping me. I added a space following your advice, however, after “clear cache and deploy site”, it still shows the error. What should I do?
2:30:40 PM: build-image version: c1f0e3189beff44ebec7048bf7ab2e75cb09660b (focal)
2:30:40 PM: buildbot version: c1f0e3189beff44ebec7048bf7ab2e75cb09660b
2:30:41 PM: Building without cache
2:30:41 PM: Starting to prepare the repo for build
2:30:41 PM: No cached dependencies found. Cloning fresh repo
2:30:41 PM: git clone --filter=blob:none https://github.com/NatsukiSh/portfolio
2:30:41 PM: Preparing Git Reference refs/heads/main
2:30:42 PM: Parsing package.json dependencies
2:30:43 PM: Starting build script
2:30:43 PM: Installing dependencies
2:30:43 PM: Python version set to 2.7
2:30:44 PM: v16.19.1 is already installed.
2:30:44 PM: Now using node v16.19.1 (npm v8.19.3)
2:30:44 PM: Enabling Node.js Corepack
2:30:44 PM: Started restoring cached build plugins
2:30:44 PM: Finished restoring cached build plugins
2:30:44 PM: Attempting Ruby version 2.7.2, read from environment
2:30:45 PM: Using Ruby version 2.7.2
2:30:45 PM: Using PHP version 8.0
2:30:45 PM: Started restoring cached corepack dependencies
2:30:45 PM: Finished restoring cached corepack dependencies
2:30:45 PM: No npm workspaces detected
2:30:45 PM: Started restoring cached node modules
2:30:45 PM: Finished restoring cached node modules
2:30:45 PM: Installing npm packages using npm version 8.19.3
2:30:50 PM: npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
2:30:50 PM: npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
2:30:50 PM: npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
2:30:53 PM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
2:30:58 PM: added 1476 packages, and audited 1477 packages in 12s
2:30:58 PM: 231 packages are looking for funding
2:30:58 PM: run `npm fund` for details
2:30:58 PM: 6 high severity vulnerabilities
2:30:58 PM: To address all issues (including breaking changes), run:
2:30:58 PM: npm audit fix --force
2:30:58 PM: Run `npm audit` for details.
2:30:58 PM: npm packages installed
2:30:58 PM: Started restoring cached go cache
2:30:58 PM: Finished restoring cached go cache
2:30:58 PM: go version go1.19.6 linux/amd64
2:30:59 PM: Detected 1 framework(s)
2:30:59 PM: "create-react-app" at version "5.0.1"
2:30:59 PM: Section completed: initializing
2:31:00 PM:
2:31:00 PM: Netlify Build
2:31:00 PM: ────────────────────────────────────────────────────────────────
2:31:00 PM:
2:31:00 PM: ❯ Version
2:31:00 PM: @netlify/build 29.5.8
2:31:00 PM:
2:31:00 PM: ❯ Flags
2:31:00 PM: baseRelDir: true
2:31:00 PM: buildId: 6404997ff041a3159d202020
2:31:00 PM: deployId: 6404997ff041a3159d202022
2:31:00 PM:
2:31:00 PM: ❯ Current directory
2:31:00 PM: /opt/build/repo
2:31:00 PM:
2:31:00 PM: ❯ Config file
2:31:00 PM: No config file was defined: using default values.
2:31:00 PM:
2:31:00 PM: ❯ Context
2:31:00 PM: production
2:31:00 PM:
2:31:00 PM: 1. Build command from Netlify app
2:31:00 PM: ────────────────────────────────────────────────────────────────
2:31:00 PM:
2:31:00 PM: $ CI= npm run build
2:31:00 PM: > portfolio@0.1.0 build
2:31:00 PM: > react-scripts build
2:31:02 PM: Creating an optimized production build...
2:31:03 PM: Failed to compile.
2:31:03 PM:
2:31:03 PM: Module not found: Error: Can't resolve './img/timezone.jpg' in '/opt/build/repo/src'
2:31:03 PM:
2:31:03 PM: "build.command" failed
2:31:03 PM: ────────────────────────────────────────────────────────────────
2:31:03 PM:
2:31:03 PM: Error message
2:31:03 PM: Command failed with exit code 1: CI= npm run build (https://ntl.fyi/exit-code-1)
2:31:03 PM:
2:31:03 PM: Error location
2:31:03 PM: In Build command from Netlify app:
2:31:03 PM: CI= npm run build
2:31:03 PM:
2:31:03 PM: Resolved config
2:31:03 PM: build:
2:31:03 PM: command: CI= npm run build
2:31:03 PM: commandOrigin: ui
2:31:03 PM: publish: /opt/build/repo/build
2:31:03 PM: publishOrigin: ui
2:31:03 PM: Caching artifacts
2:31:03 PM: Started saving node modules
2:31:03 PM: Finished saving node modules
2:31:03 PM: Started saving build plugins
2:31:03 PM: Finished saving build plugins
2:31:03 PM: Started saving corepack cache
2:31:03 PM: Finished saving corepack cache
2:31:03 PM: Started saving pip cache
2:31:03 PM: Finished saving pip cache
2:31:04 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
2:31:03 PM: Started saving emacs cask dependencies
2:31:03 PM: Finished saving emacs cask dependencies
2:31:03 PM: Started saving maven dependencies
2:31:03 PM: Finished saving maven dependencies
2:31:03 PM: Started saving boot dependencies
2:31:03 PM: Finished saving boot dependencies
2:31:03 PM: Started saving rust rustup cache
2:31:03 PM: Finished saving rust rustup cache
2:31:03 PM: Started saving go dependencies
2:31:03 PM: Finished saving go dependencies
2:31:04 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
2:31:04 PM: Failing build: Failed to build site
2:31:04 PM: Finished processing build request in 23.63s
The image seems to be missing. Check if it’s related to:
Last Reviewed By Netlify Support Staff: December 2022
Are you struggling to understand why your project runs locally but errors out with missing files or logs that point toward issues with case when you try and build on Netlify? You are not alone. Often, case (as in: UPPERCASE or lowercase letters in filenames or paths) can cause problems. Here is a guide to understanding how case sensitivity issues present themselves, why they arise, and how you can fix them!
1. Errors you might see
Case sen…
Hi hrishikesh,
Thank you so much for your help!
The file name was the problem. Thank you so much!
SamO
March 6, 2023, 3:53pm
6
hi @Natsuki thanks for sharing your solution with us! (: