Can't deploy my file because of a "failed build command"

This is the issue with my intended site deployment at https://pedantic-ritchie-ed137a.netlify.app

I’m new here therefore I apologize if I don’t know what it means.
10:30:11 AM: ────────────────────────────────────────────────────────────────
10:30:11 AM: “build.command” failed
10:30:11 AM: ────────────────────────────────────────────────────────────────
10:30:11 AM: ​
10:30:11 AM: Error message
10:30:11 AM: Command failed with exit code 1: npm run build
10:30:11 AM: ​
10:30:11 AM: Error location
10:30:11 AM: In Build command from Netlify app:
10:30:11 AM: npm run build
10:30:11 AM: ​
10:30:11 AM: Resolved config

Here’s the whole log

10:51:06 AM: Build ready to start
10:51:07 AM: build-image version: d84c79427e8f83c1ba17bcdd7b3fe38059376b68
10:51:07 AM: build-image tag: v3.6.1
10:51:07 AM: buildbot version: df42d44cc6a0381cf657a671baf049c03981bafe
10:51:07 AM: Building without cache
10:51:07 AM: Starting to prepare the repo for build
10:51:08 AM: No cached dependencies found. Cloning fresh repo
10:51:08 AM: git clone https://github.com/itsthejdp/react-studio-finder-rough-file
10:51:09 AM: Preparing Git Reference refs/heads/master
10:51:10 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘build’ versus ‘build/’ in the Netlify UI
10:51:10 AM: Starting build script
10:51:10 AM: Installing dependencies
10:51:10 AM: Python version set to 2.7
10:51:12 AM: v12.18.0 is already installed.
10:51:12 AM: Now using node v12.18.0 (npm v6.14.4)
10:51:12 AM: Started restoring cached build plugins
10:51:12 AM: Finished restoring cached build plugins
10:51:13 AM: Attempting ruby version 2.7.1, read from environment
10:51:14 AM: Using ruby version 2.7.1
10:51:15 AM: Using PHP version 5.6
10:51:15 AM: Started restoring cached node modules
10:51:15 AM: Finished restoring cached node modules
10:51:15 AM: Installing NPM modules using NPM version 6.14.4
10:51:52 AM: > core-js@2.6.12 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
10:51:52 AM: > node -e “try{require(’./postinstall’)}catch(e){}”
10:51:52 AM: > core-js@3.9.0 postinstall /opt/build/repo/node_modules/core-js
10:51:52 AM: > node -e “try{require(’./postinstall’)}catch(e){}”
10:51:52 AM: > core-js-pure@3.9.0 postinstall /opt/build/repo/node_modules/core-js-pure
10:51:52 AM: > node -e “try{require(’./postinstall’)}catch(e){}”
10:51:52 AM: > ejs@2.7.4 postinstall /opt/build/repo/node_modules/ejs
10:51:52 AM: > node ./postinstall.js
10:51:55 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
10:51:55 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:51:55 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
10:51:55 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:51:55 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
10:51:55 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
10:51:55 AM: added 1931 packages from 755 contributors and audited 1934 packages in 39.393s
10:51:57 AM: 127 packages are looking for funding
10:51:57 AM: run npm fund for details
10:51:57 AM: found 1 high severity vulnerability
10:51:57 AM: run npm audit fix to fix them, or npm audit for details
10:51:57 AM: NPM modules installed
10:51:57 AM: Started restoring cached go cache
10:51:57 AM: Finished restoring cached go cache
10:51:57 AM: go version go1.14.4 linux/amd64
10:51:57 AM: go version go1.14.4 linux/amd64
10:51:57 AM: Installing missing commands
10:51:57 AM: Verify run directory
10:51:59 AM: ​
10:51:59 AM: ────────────────────────────────────────────────────────────────
10:51:59 AM: Netlify Build
10:51:59 AM: ────────────────────────────────────────────────────────────────
10:51:59 AM: ​
10:51:59 AM: ❯ Version
10:51:59 AM: @netlify/build 9.1.3
10:51:59 AM: ​
10:51:59 AM: ❯ Flags
10:51:59 AM: deployId: 60346d9a9c416d5076661646
10:51:59 AM: mode: buildbot
10:51:59 AM: ​
10:51:59 AM: ❯ Current directory
10:51:59 AM: /opt/build/repo
10:51:59 AM: ​
10:51:59 AM: ❯ Config file
10:51:59 AM: No config file was defined: using default values.
10:51:59 AM: ​
10:51:59 AM: ❯ Context
10:51:59 AM: production
10:51:59 AM: ​
10:51:59 AM: ────────────────────────────────────────────────────────────────
10:51:59 AM: 1. Build command from Netlify app
10:51:59 AM: ────────────────────────────────────────────────────────────────
10:51:59 AM: ​
10:51:59 AM: $ npm run build
10:52:00 AM: > studio-finder@0.1.0 build /opt/build/repo
10:52:00 AM: > react-scripts build
10:52:02 AM: Creating an optimized production build…
10:52:11 AM: Failed to compile.
10:52:11 AM:
10:52:11 AM: ./src/index.scss
10:52:11 AM: Cannot find module ‘sass’
10:52:11 AM: Require stack:
10:52:11 AM: - /opt/build/repo/node_modules/sass-loader/dist/utils.js
10:52:11 AM: - /opt/build/repo/node_modules/sass-loader/dist/index.js
10:52:11 AM: - /opt/build/repo/node_modules/sass-loader/dist/cjs.js
10:52:11 AM: - /opt/build/repo/node_modules/loader-runner/lib/loadLoader.js
10:52:11 AM: - /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js
10:52:11 AM: - /opt/build/repo/node_modules/webpack/lib/NormalModule.js
10:52:11 AM: - /opt/build/repo/node_modules/webpack/lib/NormalModuleFactory.js
10:52:11 AM: - /opt/build/repo/node_modules/webpack/lib/Compiler.js
10:52:11 AM: - /opt/build/repo/node_modules/webpack/lib/webpack.js
10:52:11 AM: - /opt/build/repo/node_modules/react-scripts/scripts/build.js
10:52:11 AM: npm ERR! code ELIFECYCLE
10:52:11 AM: npm ERR! errno 1
10:52:11 AM: npm ERR! studio-finder@0.1.0 build: react-scripts build
10:52:11 AM: npm ERR! Exit status 1
10:52:11 AM: npm ERR!
10:52:11 AM: npm ERR! Failed at the studio-finder@0.1.0 build script.
10:52:11 AM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
10:52:11 AM: npm ERR! A complete log of this run can be found in:
10:52:11 AM: npm ERR! /opt/buildhome/.npm/_logs/2021-02-23T02_52_11_716Z-debug.log
10:52:11 AM: ​
10:52:11 AM: ────────────────────────────────────────────────────────────────
10:52:11 AM: “build.command” failed
10:52:11 AM: ────────────────────────────────────────────────────────────────
10:52:11 AM: ​
10:52:11 AM: Error message
10:52:11 AM: Command failed with exit code 1: npm run build
10:52:11 AM: ​
10:52:11 AM: Error location
10:52:11 AM: In Build command from Netlify app:
10:52:11 AM: npm run build
10:52:11 AM: ​
10:52:11 AM: Resolved config
10:52:11 AM: build:
10:52:11 AM: command: npm run build
10:52:11 AM: commandOrigin: ui
10:52:11 AM: publish: /opt/build/repo/build
10:52:11 AM: Caching artifacts
10:52:11 AM: Started saving node modules
10:52:11 AM: Finished saving node modules
10:52:11 AM: Started saving build plugins
10:52:11 AM: Finished saving build plugins
10:52:11 AM: Started saving pip cache
10:52:12 AM: Finished saving pip cache
10:52:12 AM: Started saving emacs cask dependencies
10:52:12 AM: Finished saving emacs cask dependencies
10:52:12 AM: Started saving maven dependencies
10:52:12 AM: Finished saving maven dependencies
10:52:12 AM: Started saving boot dependencies
10:52:12 AM: Finished saving boot dependencies
10:52:12 AM: Started saving rust rustup cache
10:52:12 AM: Finished saving rust rustup cache
10:52:12 AM: Started saving go dependencies
10:52:12 AM: Finished saving go dependencies
10:52:14 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:52:14 AM: Failing build: Failed to build site
10:52:14 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
10:52:15 AM: Finished processing build request in 1m7.308780705s

Hey there and welcome!

It looks like you’re missing the sass module. Try adding it with npm install -D sass.

Hi! Do I log this into the terminal (Git Bash)? I recall installing sass on it when I made this project

Yep! In the same directory as package.json. It’s easy to check if this file contains sass though before you install it. Just type: grep sass package.json. If it does contain it, please post all the content of your package.json here!

1 Like

Hi, thanks for that, it installed, yet when I tried to deploy it, it failed and showed the same error.

My package.json

{
  "name": "studio-finder",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.11.9",
    "@testing-library/react": "^11.2.5",
    "@testing-library/user-event": "^12.7.1",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-scripts": "4.0.2",
    "web-vitals": "^1.1.0"
  },
  "scripts": {
    "start": "set PORT=3001 && react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "sass": "^1.32.8"
  }
}

I tried making a new repository on GitHub yet it keeps saying: “Error: remote original already exists.”

Gaahh this is so frustrating. 7+ hours already of trying to deploy a netlify site through Git…

Are you sure it was the exact same error?

And would it be possible to check out your repo in order to help better?

I appreciate you getting back to me! I have finally deployed the site, and your suggestion to install sass was the one that had it fixed. Thank you very much.

I made it work by creating a new repo, eventually got that git problem thing figured out (sorry it’s my 1st day working with Netlify & Git) and deployed on a new site. My guess was that in my initial deployed site, the sass installation was probably not detected…

I appreciate it because I can hopefully use continuous deployment instead of using the drag file method all the time. The stress has subsided! :slight_smile: Cheers.

1 Like

Glad to hear it! Good luck in your future Netlify endeavors!