I'm getting "build.command" failed when deploying to production

I’ve read that you guys have made a change that rolled out a few days ago and I’ve tried the way you’ve mentioned to rectify this but to no avail.

CI= npm run build

Not sure what else to do. The website works fine and deployment was fine before. Not sure what to do :frowning_face:

hi there, can you link or paste the full deploy log please so we can take a look?

hey!! sure here it is :slightly_smiling_face: @perry

12:34:03 PM: Build ready to start
12:34:05 PM: build-image version: c23500190e408b04bdfcf9703d16c460ef03b813
12:34:05 PM: build-image tag: v3.3.15
12:34:05 PM: buildbot version: 85ab9be17c6555a1d991d1cf7b0dbb73c18d0b92
12:34:05 PM: Fetching cached dependencies
12:34:05 PM: Starting to download cache of 254.3KB
12:34:05 PM: Finished downloading cache in 74.308668ms
12:34:05 PM: Starting to extract cache
12:34:05 PM: Failed to fetch cache, continuing with build
12:34:05 PM: Starting to prepare the repo for build
12:34:10 PM: No cached dependencies found. Cloning fresh repo
12:34:10 PM: git clone git@bitbucket.org:cruskip/cruskip_website
12:34:14 PM: Preparing Git Reference refs/heads/master
12:34:15 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'build' versus 'build/' in the Netlify UI
12:34:15 PM: Starting build script
12:34:15 PM: Installing dependencies
12:34:15 PM: Python version set to 2.7
12:34:17 PM: Downloading and installing node v10.21.0...
12:34:17 PM: Downloading https://nodejs.org/dist/v10.21.0/node-v10.21.0-linux-x64.tar.xz...
12:34:17 PM: Computing checksum with sha256sum
12:34:17 PM: Checksums matched!
12:34:19 PM: Now using node v10.21.0 (npm v6.14.4)
12:34:19 PM: Started restoring cached build plugins
12:34:19 PM: Finished restoring cached build plugins
12:34:20 PM: Attempting ruby version 2.6.2, read from environment
12:34:21 PM: Using ruby version 2.6.2
12:34:21 PM: Using PHP version 5.6
12:34:21 PM: 5.2 is already installed.
12:34:21 PM: Using Swift version 5.2
12:34:21 PM: Started restoring cached node modules
12:34:21 PM: Finished restoring cached node modules
12:34:21 PM: Installing NPM modules using NPM version 6.14.4
12:34:45 PM: > node-sass@4.13.0 install /opt/build/repo/node_modules/node-sass
12:34:45 PM: > node scripts/install.js
12:34:45 PM: Downloading binary from https://github.com/sass/node-sass/releases/download/v4.13.0/linux-x64-64_binding.node
12:34:46 PM: Download complete
12:34:46 PM: Binary saved to /opt/build/repo/node_modules/node-sass/vendor/linux-x64-64/binding.node
12:34:46 PM: Caching binary to /opt/buildhome/.npm/node-sass/4.13.0/linux-x64-64_binding.node
12:34:46 PM: > core-js@2.6.10 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
12:34:46 PM: > node postinstall || echo "ignore"
12:34:46 PM: > core-js@3.2.1 postinstall /opt/build/repo/node_modules/core-js
12:34:46 PM: > node scripts/postinstall || echo "ignore"
12:34:46 PM: > node-sass@4.13.0 postinstall /opt/build/repo/node_modules/node-sass
12:34:46 PM: > node scripts/build.js
12:34:47 PM: Binary found at /opt/build/repo/node_modules/node-sass/vendor/linux-x64-64/binding.node
12:34:47 PM: Testing binary
12:34:47 PM: Binary is fine
12:34:47 PM: > styled-components@4.4.0 postinstall /opt/build/repo/node_modules/styled-components
12:34:47 PM: > node ./scripts/postinstall.js || exit 0
12:34:47 PM: Use styled-components at work? Consider supporting our development efforts at https://opencollective.com/styled-components
12:34:49 PM: npm
12:34:49 PM: WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/webpack-dev-server/node_modules/fsevents):
12:34:49 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
12:34:49 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/watchpack/node_modules/fsevents):
12:34:49 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
12:34:49 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/jest-haste-map/node_modules/fsevents):
12:34:49 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
12:34:49 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fork-ts-checker-webpack-plugin/node_modules/fsevents):
12:34:49 PM: npm
12:34:49 PM: WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
12:34:49 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.0.7 (node_modules/fsevents):
12:34:49 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.0.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
12:34:49 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.1 (node_modules/chokidar/node_modules/fsevents):
12:34:49 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
12:34:49 PM: added 1624 packages from 722 contributors and audited 1894 packages in 26.876s
12:34:50 PM: found 38962 vulnerabilities (38937 low, 21 moderate, 4 high)
12:34:50 PM:   run `npm audit fix` to fix them, or `npm audit` for details
12:34:50 PM: NPM modules installed
12:34:51 PM: Started restoring cached go cache
12:34:51 PM: Finished restoring cached go cache
12:34:51 PM: go version go1.12 linux/amd64
12:34:51 PM: go version go1.12 linux/amd64
12:34:51 PM: Installing missing commands
12:34:51 PM: Verify run directory
12:34:52 PM: ​
12:34:52 PM: ┌─────────────────────────────┐
12:34:52 PM: │        Netlify Build        │
12:34:52 PM: └─────────────────────────────┘
12:34:52 PM: ​
12:34:52 PM: ❯ Version
12:34:52 PM:   @netlify/build 2.0.10
12:34:52 PM: ​
12:34:52 PM: ❯ Flags
12:34:52 PM:   deployId: 5eea45fbb4be41019c718220
12:34:52 PM:   mode: buildbot
12:34:52 PM: ​
12:34:52 PM: ❯ Current directory
12:34:52 PM:   /opt/build/repo
12:34:52 PM: ​
12:34:52 PM: ❯ Config file
12:34:52 PM:   No config file was defined: using default values.
12:34:52 PM: ​
12:34:52 PM: ❯ Context
12:34:52 PM:   production
12:34:52 PM: ​
12:34:52 PM: ┌────────────────────────────────┐
12:34:52 PM: │ 1. Build command from settings │
12:34:52 PM: └────────────────────────────────┘
12:34:52 PM: ​
12:34:52 PM: $ npm run build
12:34:52 PM: > cruskip_website@0.1.0 build /opt/build/repo
12:34:52 PM: > react-scripts build
12:34:54 PM: Creating an optimized production build...
12:34:55 PM: Browserslist: caniuse-lite is outdated. Please run next command `npm update`
12:35:09 PM: 
12:35:09 PM: Treating warnings as errors because process.env.CI = true.
12:35:09 PM: Most CI servers set it automatically.
12:35:09 PM: 
12:35:09 PM: Failed to compile.
12:35:09 PM: 
12:35:09 PM: ./src/context.js
12:35:09 PM:   Line 102:13:  Nested block is redundant  no-lone-blocks
12:35:09 PM:   Line 122:17:  Nested block is redundant  no-lone-blocks
12:35:09 PM: ./src/components/Navbar.js
12:35:09 PM:   Line 3:8:  'logo' is defined but never used  no-unused-vars
12:35:09 PM: ./src/components/Details.js
12:35:09 PM:   Line 42:32:  'company' is assigned a value but never used  no-unused-vars
12:35:09 PM: ./src/components/Cart/CartItem.js
12:35:09 PM:   Line 4:28:  'price' is assigned a value but never used  no-unused-vars
12:35:09 PM:   Line 4:35:  'total' is assigned a value but never used  no-unused-vars
12:35:09 PM: npm
12:35:09 PM: ERR!
12:35:09 PM:  code ELIFECYCLE
12:35:09 PM: npm
12:35:09 PM: ERR! errno 1
12:35:09 PM: npm ERR! cruskip_website@0.1.0 build: `react-scripts build`
12:35:09 PM: npm ERR! Exit status 1
12:35:09 PM: npm ERR!
12:35:09 PM: npm ERR! Failed at the cruskip_website@0.1.0 build script.
12:35:09 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
12:35:09 PM: npm
12:35:09 PM: ERR! A complete log of this run can be found in:
12:35:09 PM: npm ERR!     /opt/buildhome/.npm/_logs/2020-06-17T16_35_09_402Z-debug.log
12:35:09 PM: ​
12:35:09 PM: ┌─────────────────────────────┐
12:35:09 PM: │   "build.command" failed    │
12:35:09 PM: └─────────────────────────────┘
12:35:09 PM: ​
12:35:09 PM:   Error message
12:35:09 PM:   Command failed with exit code 1: npm run build
12:35:09 PM: ​
12:35:09 PM:   Error location
12:35:09 PM:   In Build command from settings:
12:35:09 PM:   npm run build
12:35:09 PM: ​
12:35:09 PM:   Resolved config
12:35:09 PM:   build:
12:35:09 PM:     command: npm run build
12:35:09 PM:     publish: /opt/build/repo/build
12:35:09 PM: Caching artifacts
12:35:09 PM: Started saving node modules
12:35:09 PM: Finished saving node modules
12:35:09 PM: Started saving build plugins
12:35:09 PM: Finished saving build plugins
12:35:09 PM: Started saving pip cache
12:35:09 PM: Finished saving pip cache
12:35:09 PM: Started saving emacs cask dependencies
12:35:09 PM: Finished saving emacs cask dependencies
12:35:09 PM: Started saving maven dependencies
12:35:09 PM: Finished saving maven dependencies
12:35:09 PM: Started saving boot dependencies
12:35:09 PM: Finished saving boot dependencies
12:35:09 PM: Started saving go dependencies
12:35:09 PM: Finished saving go dependencies
12:35:12 PM: Error running command: Build script returned non-zero exit code: 1
12:35:12 PM: Failing build: Failed to build site
12:35:12 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
12:35:13 PM: Finished processing build request in 1m7.605505531s

hey @perry, any updates?

hey there, mike looked at your site and it seems like the settings still aren’t quite right. we wrote some slightly clearer instructions in the post we linked, can you take another look?

@perry I’ve tried this already but it didn’t work. Is there anything else I can try?

hi @gv27, in the other thread you mentioned that you ran this command in the command line. Can you confirm that you tried adding this to your toml file as mike explained in his comment, OR set it in the Netlify UI build settings (not command line)? thanks! just making sure.

hey @perry, I was going to ask - where is my toml file? I’ve never used this in terms of deployment before. Also, where can I set it in the Netlify UI build settings?

hey there,

this is a great place to start:

@perry got it to work - deployed successfully - thanks a lot :slightly_smiling_face:

1 Like

awesome~!! glad we got there in the end :+1: