Home
Support Forums

Netlify yet again fails building when deploying

Hello, so I have yet again another problem with deploying my app, it worked fine until I deployed my new update. please bare with me since I am still new to Netlify, I need my app to be deployed very soon since its a job application assignment, your help is very much appreciated, have a nice day.

This is my app name : https://seedingfund.netlify.app

my package.json file:

{
  "homepage": "./",
  "name": "seedingfund",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@devexpress/dx-react-chart": "^2.7.6",
    "@devexpress/dx-react-chart-material-ui": "^2.7.6",
    "@emotion/react": "^11.4.1",
    "@emotion/styled": "^11.3.0",
    "@material-ui/core": "^4.12.3",
    "@mui/icons-material": "^5.0.1",
    "@mui/material": "^5.0.2",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "axios": "^0.22.0",
    "material-ui-icons": "^1.0.0-beta.36",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-loader-spinner": "^4.0.0",
    "react-redux": "^7.2.5",
    "react-router": "^5.2.1",
    "react-router-dom": "^5.3.0",
    "react-scripts": "^1.1.5",
    "web-vitals": "^1.0.1"
  },
  "scripts": {
    "start": "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 op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

deploy log:

8:40:35 AM: Build ready to start
8:40:38 AM: build-image version: 081db65c3e4ce8423fedb40e7689a87de6f84667
8:40:38 AM: build-image tag: v4.3.1
8:40:38 AM: buildbot version: 29fef7ab5dc568ca81434ff0643fc14ddc7b88ab
8:40:39 AM: Fetching cached dependencies
8:40:39 AM: Starting to download cache of 156.1MB
8:40:40 AM: Finished downloading cache in 1.442432571s
8:40:40 AM: Starting to extract cache
8:40:46 AM: Finished extracting cache in 6.34254071s
8:40:46 AM: Finished fetching cache in 7.821828749s
8:40:46 AM: Starting to prepare the repo for build
8:40:47 AM: Preparing Git Reference pull/4/head
8:40:47 AM: Parsing package.json dependencies
8:40:48 AM: Starting build script
8:40:48 AM: Installing dependencies
8:40:48 AM: Python version set to 2.7
8:40:48 AM: Started restoring cached node version
8:40:50 AM: Finished restoring cached node version
8:40:50 AM: v16.10.0 is already installed.
8:40:51 AM: Now using node v16.10.0 (npm v7.24.0)
8:40:51 AM: Started restoring cached build plugins
8:40:51 AM: Finished restoring cached build plugins
8:40:51 AM: Attempting ruby version 2.7.2, read from environment
8:40:52 AM: Using ruby version 2.7.2
8:40:53 AM: Using PHP version 8.0
8:40:53 AM: Started restoring cached node modules
8:40:53 AM: Finished restoring cached node modules
8:40:53 AM: Installing NPM modules using NPM version 7.24.0
8:41:03 AM: added 16 packages, and audited 1911 packages in 9s
8:41:03 AM: 74 packages are looking for funding
8:41:03 AM:   run `npm fund` for details
8:41:03 AM: 52 vulnerabilities (33 low, 5 moderate, 14 high)
8:41:03 AM: To address issues that do not require attention, run:
8:41:03 AM:   npm audit fix
8:41:03 AM: To address all issues (including breaking changes), run:
8:41:03 AM:   npm audit fix --force
8:41:03 AM: Run `npm audit` for details.
8:41:03 AM: NPM modules installed
8:41:03 AM: Started restoring cached go cache
8:41:03 AM: Finished restoring cached go cache
8:41:03 AM: go version go1.16.5 linux/amd64
8:41:03 AM: go version go1.16.5 linux/amd64
8:41:03 AM: Installing missing commands
8:41:03 AM: Verify run directory
8:41:05 AM: ​
8:41:05 AM: ────────────────────────────────────────────────────────────────
8:41:05 AM:   Netlify Build                                                 
8:41:05 AM: ────────────────────────────────────────────────────────────────
8:41:05 AM: ​
8:41:05 AM: ❯ Version
8:41:05 AM:   @netlify/build 18.13.7
8:41:05 AM: ​
8:41:05 AM: ❯ Flags
8:41:05 AM:   baseRelDir: true
8:41:05 AM:   buildId: 615be55396f1d900074b81d1
8:41:05 AM:   deployId: 615be55396f1d900074b81d3
8:41:05 AM: ​
8:41:05 AM: ❯ Current directory
8:41:05 AM:   /opt/build/repo
8:41:05 AM: ​
8:41:05 AM: ❯ Config file
8:41:05 AM:   No config file was defined: using default values.
8:41:05 AM: ​
8:41:05 AM: ❯ Context
8:41:05 AM:   deploy-preview
8:41:05 AM: ​
8:41:05 AM: ────────────────────────────────────────────────────────────────
8:41:05 AM:   1. Build command from Netlify app                             
8:41:05 AM: ────────────────────────────────────────────────────────────────
8:41:05 AM: ​
8:41:05 AM: $ CI= npm run build
8:41:05 AM: > seedingfund@0.1.0 build
8:41:05 AM: > react-scripts build
8:41:06 AM: Creating an optimized production build...
8:41:15 AM: Failed to compile.
8:41:15 AM: 
8:41:15 AM: Failed to minify the code from this file:
8:41:15 AM:  	./node_modules/@mui/system/esm/style.js:9
8:41:15 AM: Read more here: http://bit.ly/2tRViJ9
8:41:15 AM: ​
8:41:15 AM: ────────────────────────────────────────────────────────────────
8:41:15 AM:   "build.command" failed                                        
8:41:15 AM: ────────────────────────────────────────────────────────────────
8:41:15 AM: ​
8:41:15 AM:   Error message
8:41:15 AM:   Command failed with exit code 1: CI= npm run build
8:41:15 AM: ​
8:41:15 AM:   Error location
8:41:15 AM:   In Build command from Netlify app:
8:41:15 AM:   CI= npm run build
8:41:15 AM: ​
8:41:15 AM:   Resolved config
8:41:15 AM:   build:
8:41:15 AM:     command: CI= npm run build
8:41:15 AM:     commandOrigin: ui
8:41:15 AM:     environment:
8:41:15 AM:       - REVIEW_ID
8:41:15 AM:     publish: /opt/build/repo/build
8:41:15 AM:     publishOrigin: ui
8:41:15 AM: Caching artifacts
8:41:15 AM: Started saving node modules
8:41:15 AM: Finished saving node modules
8:41:15 AM: Started saving build plugins
8:41:15 AM: Finished saving build plugins
8:41:15 AM: Started saving pip cache
8:41:15 AM: Finished saving pip cache
8:41:15 AM: Started saving emacs cask dependencies
8:41:15 AM: Finished saving emacs cask dependencies
8:41:15 AM: Started saving maven dependencies
8:41:15 AM: Finished saving maven dependencies
8:41:15 AM: Started saving boot dependencies
8:41:15 AM: Finished saving boot dependencies
8:41:15 AM: Started saving rust rustup cache
8:41:15 AM: Finished saving rust rustup cache
8:41:15 AM: Started saving go dependencies
8:41:15 AM: Finished saving go dependencies
8:41:15 AM: Creating deploy upload records
8:41:15 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:41:15 AM: Failing build: Failed to build site
8:41:15 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2
8:41:16 AM: Finished processing build request in 37.376885066s

Hi @SoulsReaper

Did you try building your site locally?

I tried building on my computer and get the same error. So this is not a Netlify-specific problem.

Have you checked out the mui documentation?

1 Like

Hello, I didn’t , how can I check with this locally?
I tried netlify build and it gave me an error :

netlify build

────────────────────────────────────────────────────────────────
  Netlify Build                                                 
────────────────────────────────────────────────────────────────

❯ Version
  @netlify/build 11.13.0

❯ Flags
  {}

❯ Current directory
  /home/souls/Desktop/My Work/backup/seedingfund

❯ Config file
  No config file was defined: using default values.

❯ Context
  production

────────────────────────────────────────────────────────────────
  1. Build command from Netlify app                             
────────────────────────────────────────────────────────────────

$ CI= npm run build

> seedingfund@0.1.0 build /home/souls/Desktop/My Work/backup/seedingfund
> react-scripts build

Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file: 

 	./node_modules/@mui/system/esm/style.js:9 

Read more here: http://bit.ly/2tRViJ9


npm ERR! Linux 5.11.0-37-generic
npm ERR! argv "/usr/local/bin/node" "/home/souls/node_modules/.bin/npm" "run" "build"
npm ERR! node v16.3.0
npm ERR! npm  v2.15.12
npm ERR! code ELIFECYCLE
npm ERR! seedingfund@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the seedingfund@0.1.0 build script 'react-scripts build'.
npm ERR! This is most likely a problem with the seedingfund package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     react-scripts build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs seedingfund
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls seedingfund
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/souls/Desktop/My Work/backup/seedingfund/npm-debug.log

────────────────────────────────────────────────────────────────
  "build.command" failed                                        
────────────────────────────────────────────────────────────────

  Error message
  Command failed with exit code 1: CI= npm run build

  Error location
  In Build command from Netlify app:
  CI= npm run build

  Resolved config
  build:
    command: CI= npm run build
    commandOrigin: ui
    publish: /home/souls/Desktop/My Work/backup/seedingfund/build

   ╭───────────────────────────────────────╮
   │                                       │
   │   Update available 3.29.7 → 6.9.30    │
   │    Run npm i netlify-cli to update    │
   │                                       │
   ╰───────────────────────────────────────╯

This is the same error on npm run build :

npm run build

> seedingfund@0.1.0 build
> react-scripts build

Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file: 

 	./node_modules/@mui/system/esm/style.js:9 

Read more here: http://bit.ly/2tRViJ9

Thanks for pointing that out, I had to update create-react-app globally, then update my app on new react packages, the problem wast from react-scripts as mentioned in stackoverflow, i had an older version and It needed to be updated :slight_smile:

1 Like