Fail to Deploying a react project from GitHub

1:52:07 AM: build-image version: 50f2c07b4ff67fac131b5b345ef7efb7e0ab9dac (focal)

1:52:07 AM: buildbot version: 3c77419a32191e587913c896861b4b2804c7fa10

1:52:07 AM: Fetching cached dependencies

1:52:07 AM: Failed to fetch cache, continuing with build

1:52:07 AM: Starting to prepare the repo for build

1:52:07 AM: No cached dependencies found. Cloning fresh repo

1:52:07 AM: git clone --filter=blob:none https://github.com/MrShuja/portfolio-react

1:52:07 AM: Preparing Git Reference refs/heads/main

1:52:09 AM: Starting to install dependencies

1:52:09 AM: Python version set to 3.8

1:52:09 AM: Attempting Ruby version 2.7.2, read from environment

1:52:10 AM: Using Ruby version 2.7.2

1:52:10 AM: Started restoring cached go cache

1:52:10 AM: Finished restoring cached go cache

1:52:10 AM: go version go1.19.13 linux/amd64

1:52:11 AM: Using PHP version 8.0

1:52:12 AM: v18.18.2 is already installed.

1:52:12 AM: Now using node v18.18.2 (npm v9.8.1)

1:52:12 AM: Enabling Node.js Corepack

1:52:12 AM: Started restoring cached build plugins

1:52:12 AM: Finished restoring cached build plugins

1:52:12 AM: Started restoring cached corepack dependencies

1:52:12 AM: Finished restoring cached corepack dependencies

1:52:12 AM: No npm workspaces detected

1:52:12 AM: Started restoring cached node modules

1:52:12 AM: Finished restoring cached node modules

1:52:12 AM: Installing npm packages using npm version 9.8.1

1:52:14 AM: Failed during stage “Install dependencies”: dependency_installation script returned non-zero exit code: 1

1:52:14 AM: npm ERR! code ERESOLVE

1:52:14 AM: npm ERR! ERESOLVE could not resolve

1:52:14 AM: npm ERR!

1:52:14 AM: npm ERR! While resolving: react-typical@0.1.3

1:52:14 AM: npm ERR! Found: react@18.2.0

1:52:14 AM: npm ERR! node_modules/react

1:52:14 AM: npm ERR! react@“^18.2.0” from the root project

1:52:14 AM: npm ERR! react@“18.2.0” from @react-email/render@0.0.6

1:52:14 AM: npm ERR! node_modules/@react-email/render

1:52:14 AM: npm ERR! @react-email/render@“0.0.6” from react-email@1.9.5

1:52:14 AM: npm ERR! node_modules/react-email

1:52:14 AM: npm ERR! react-email@“^1.9.5” from the root project

1:52:14 AM: npm ERR! 10 more (@testing-library/react, framer-motion, react-dom, …)

1:52:14 AM: npm ERR!

1:52:14 AM: npm ERR! Could not resolve dependency:

1:52:14 AM: npm ERR! peer react@“^15.0.0 || ^16.0.0” from react-typical@0.1.3

1:52:14 AM: npm ERR! node_modules/react-typical

1:52:14 AM: npm ERR! react-typical@“^0.1.3” from the root project

1:52:14 AM: npm ERR!

1:52:14 AM: npm ERR! Conflicting peer dependency: react@16.14.0

1:52:14 AM: npm ERR! node_modules/react

1:52:14 AM: npm ERR! peer react@“^15.0.0 || ^16.0.0” from react-typical@0.1.3

1:52:14 AM: npm ERR! node_modules/react-typical

1:52:14 AM: npm ERR! react-typical@“^0.1.3” from the root project

1:52:14 AM: npm ERR!

1:52:14 AM: npm ERR! Fix the upstream dependency conflict, or retry

1:52:14 AM: npm ERR! this command with --force or --legacy-peer-deps

1:52:14 AM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

1:52:14 AM: npm ERR!

1:52:14 AM: npm ERR!

1:52:14 AM: npm ERR! For a full report see:

1:52:14 AM: npm ERR! /opt/buildhome/.npm/_logs/2023-10-28T08_52_12_937Z-eresolve-report.txt

1:52:14 AM: npm ERR! A complete log of this run can be found in: /opt/buildhome/.npm/_logs/2023-10-28T08_52_12_937Z-debug-0.log

1:52:14 AM: Error during npm install

1:52:14 AM: Build was terminated: dependency_installation script returned non-zero exit code: 1

1:52:14 AM: Failing build: Failed to install dependencies

B

In progress

1:52:14 AM: Finished processing build request in 6.92s

@Shuja See this thread:

Respected Sir, after the adding the NPM_FLAGS , there occur another error while building the project.

9:12:32 AM: Netlify Build

9:12:32 AM: ────────────────────────────────────────────────────────────────

9:12:32 AM: ​

9:12:32 AM: ❯ Version

9:12:32 AM: @netlify/build 29.24.0

9:12:32 AM: ​

9:12:32 AM: ❯ Flags

9:12:32 AM: baseRelDir: true

9:12:32 AM: buildId: 653e8435779d1a0f24281c03

9:12:32 AM: deployId: 653e8435779d1a0f24281c05

9:12:32 AM: ​

9:12:32 AM: ❯ Current directory

9:12:32 AM: /opt/build/repo

9:12:32 AM: ​

9:12:32 AM: ❯ Config file

9:12:32 AM: No config file was defined: using default values.

9:12:32 AM: ​

9:12:32 AM: ❯ Context

9:12:32 AM: production

9:12:32 AM: ​

9:12:32 AM: Build command from Netlify app

9:12:32 AM: ────────────────────────────────────────────────────────────────

9:12:32 AM: ​

9:12:32 AM: $ npm run build

9:12:32 AM: > client@0.1.0 build

9:12:32 AM: > react-scripts build

9:12:33 AM: Creating an optimized production build…

9:12:37 AM: One of your dependencies, babel-preset-react-app, is importing the

9:12:37 AM: “@babel/plugin-proposal-private-property-in-object” package without

9:12:37 AM: declaring it in its dependencies. This is currently working because

9:12:37 AM: “@babel/plugin-proposal-private-property-in-object” is already in your

9:12:37 AM: node_modules folder for unrelated reasons, but it may break at any time.

9:12:37 AM: babel-preset-react-app is part of the create-react-app project, which

9:12:37 AM: is not maintianed anymore. It is thus unlikely that this bug will

9:12:37 AM: ever be fixed. Add “@babel/plugin-proposal-private-property-in-object” to

9:12:37 AM: your devDependencies to work around this error. This will make this message

9:12:37 AM: go away.

9:12:50 AM: Failed during stage “building site”: Build script returned non-zero exit code: 2

9:12:49 AM:

9:12:49 AM: Treating warnings as errors because process.env.CI = true.

9:12:49 AM: Most CI servers set it automatically.

9:12:49 AM:

9:12:49 AM: Failed to compile.

9:12:49 AM:

9:12:49 AM: Warning

9:12:49 AM: (1:458) autoprefixer: start value has mixed support, consider using flex-start instead

9:12:49 AM: Warning

9:12:49 AM: (1:458) autoprefixer: start value has mixed support, consider using flex-start instead

9:12:49 AM: [eslint]

9:12:49 AM: src/App.js

9:12:49 AM: Line 9:8: “ScrollContainer” is defined but never used no-unused-vars

9:12:49 AM: src/Components/About/About.jsx

9:12:49 AM: Line 7:8: “Expertise” is defined but never used no-unused-vars

9:12:49 AM: src/Components/Expertise/Expertise.jsx

9:12:49 AM: Line 4:43: “FaRedux” is defined but never used no-unused-vars

9:12:49 AM: Line 4:52: “FaRandom” is defined but never used no-unused-vars

9:12:49 AM: Line 8:8: “Contact” is defined but never used no-unused-vars

9:12:49 AM: src/Components/Header/Header.jsx

9:12:49 AM: Line 14:16: “setText” is assigned a value but never used no-unused-vars

9:12:49 AM: src/Components/Home/Home.jsx

9:12:49 AM: Line 1:16: “Component” is defined but never used no-unused-vars

9:12:49 AM: Line 6:8: “About” is defined but never used no-unused-vars

9:12:49 AM: src/Styles/ScrollingContainer.jsx

9:12:49 AM: Line 2:10: “useLocation” is defined but never used no-unused-vars

9:12:49 AM: ​

9:12:49 AM: “build.command” failed

9:12:49 AM: ────────────────────────────────────────────────────────────────

9:12:49 AM: ​

9:12:49 AM: Error message

9:12:49 AM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)

9:12:49 AM: ​

9:12:49 AM: Error location

9:12:49 AM: In Build command from Netlify app:

9:12:49 AM: npm run build

9:12:49 AM: ​

9:12:49 AM: Resolved config

9:12:49 AM: build:

9:12:49 AM: command: npm run build

9:12:49 AM: commandOrigin: ui

9:12:49 AM: environment:

9:12:49 AM: - NPM_FLAGS

9:12:49 AM: publish: /opt/build/repo/CI= build

9:12:49 AM: publishOrigin: ui

9:12:50 AM: Build failed due to a user error: Build script returned non-zero exit code: 2

9:12:50 AM: Failing build: Failed to build site

9:12:50 AM: Finished processing build request in 47.926s

Deploying

Skipped

Cleanup

Skipped

Post-processing

Skipped

@Shuja This is an entirely different issue.

9:12:49 AM: Treating warnings as errors because process.env.CI = true.
9:12:49 AM: Most CI servers set it automatically.

As this says, your build is treating warnings as errors.
All errors cause your build to fail.

You can disable this default behavior by setting CI to false.
The easist way to do that being to change your Build command
from npm run build
to CI= npm run build