Command failed with exit code 1: npm run build while local deployment is fine

Hello! My site builds perfect locally but does not on netlify. I cant tell what the error is by this message.
My site name is princecharming.netlify.app
This is the site id: c6310880-b384-442c-bf1e-e9509194dc8a

This is my build log:
5:38:55 PM: Waiting for other deploys from your team to complete. Check the queue:
5:39:59 PM: build-image version: fcb0c1b3ada6d25c1cb58e8bc514f5f23cc14f15 (focal)
5:39:59 PM: buildbot version: fb93098f8bc97793cd0cfc3c46306bbf28bb04e9
5:39:59 PM: Fetching cached dependencies
5:39:59 PM: Failed to fetch cache, continuing with build
5:39:59 PM: Starting to prepare the repo for build
5:40:00 PM: No cached dependencies found. Cloning fresh repo
5:40:00 PM: git clone --filter=blob:none
5:40:00 PM: Preparing Git Reference refs/heads/main
5:40:05 PM: Starting to install dependencies
5:40:08 PM: Python version set to 3.8
5:40:08 PM: Attempting Ruby version 2.7.2, read from environment
5:40:09 PM: Using Ruby version 2.7.2
5:40:09 PM: Started restoring cached go cache
5:40:09 PM: Finished restoring cached go cache
5:40:11 PM: go version go1.19.13 linux/amd64
5:40:12 PM: Using PHP version 8.0
5:40:13 PM: Downloading and installing node v18.19.1…
5:40:13 PM: Downloading https nodejs.org/dist/v18.19.1/node-v18.19.1-linux-x64.tar.xz
5:40:14 PM: Computing checksum with sha256sum
5:40:14 PM: Checksums matched!
5:40:17 PM: Now using node v18.19.1 (npm v10.2.4)
5:40:17 PM: Enabling Node.js Corepack
5:40:17 PM: Started restoring cached build plugins
5:40:17 PM: Finished restoring cached build plugins
5:40:17 PM: Started restoring cached corepack dependencies
5:40:17 PM: Finished restoring cached corepack dependencies
5:40:17 PM: No npm workspaces detected
5:40:17 PM: Started restoring cached node modules
5:40:17 PM: Finished restoring cached node modules
5:40:17 PM: Installing npm packages using npm version 10.2.4
5:40:32 PM: npm WARN deprecated urix0.1.0: Please see https GitHub - lydell/urix: [DEPRECATED] Makes Windows-style paths more unix and URI friendly.
5:40:32 PM: npm WARN deprecated stable0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https Array.prototype.sort() - JavaScript | MDN
5:40:32 PM: npm WARN deprecated resolve-url0.2.1: https GitHub - lydell/resolve-url: [DEPRECATED] Like Node.js’ `path.resolve`/`url.resolve` for the browser.
5:40:32 PM: npm WARN deprecated source-map-url0.4.1: See https GitHub - lydell/source-map-url: [DEPRECATED] Tools for working with sourceMappingURL comments.
5:40:32 PM: npm WARN deprecated gulp-header1.8.12: Removed event-stream from gulp-header
5:40:33 PM: npm WARN deprecated babel/plugin-proposal-nullish-coalescing-operator7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use babel/plugin-transform-nullish-coalescing-operator instead.
5:40:33 PM: npm WARN deprecated rollup-plugin-terser7.0.2: This package has been deprecated and is no longer maintained. Please use rollup/plugin-terser
5:40:33 PM: npm WARN deprecated acorn-dynamic-import2.0.2: This is probably built in to whatever tool you"re using. If you still need it… idk
npm WARN deprecated babel/plugin-proposal-class-properties7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use babel/plugin-transform-class-properties instead.
5:40:33 PM: npm WARN deprecated babel/plugin-proposal-private-methods7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use babel/plugin-transform-private-methods instead.
5:40:33 PM: npm WARN deprecated babel/plugin-proposal-numeric-separator7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use babel/plugin-transform-numeric-separator instead.
5:40:33 PM: npm WARN deprecated sourcemap-codec1.4.8: Please use jridgewell/sourcemap-codec instead
5:40:34 PM: npm WARN deprecated domexception2.0.1: Use your platform"s native DOMException instead
npm WARN deprecated abab2.0.6: Use your platform"s native atob() and btoa() methods instead
npm WARN deprecated w3c-hr-time1.0.2: Use your platform"s native performance.now() and performance.timeOrigin.
npm WARN deprecated babel/plugin-proposal-optional-chaining7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use babel/plugin-transform-optional-chaining instead.
5:40:34 PM: npm WARN deprecated source-map-resolve0.5.3: See https GitHub - lydell/source-map-resolve: [DEPRECATED] Resolve the source map and/or sources for a generated file.
5:40:35 PM: npm WARN deprecated chokidar2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
5:40:35 PM: npm WARN deprecated workbox-cacheable-response6.6.0: workbox-background-sync6.6.0
5:40:36 PM: npm WARN deprecated coffee-script1.12.7: CoffeeScript on NPM has moved to “coffeescript” (no hyphen)
5:40:37 PM: npm WARN deprecated svgo1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
5:40:56 PM: added 2316 packages, and audited 2317 packages in 39s
5:40:56 PM: 419 packages are looking for funding
5:40:56 PM: run npm fund for details
5:40:56 PM: 20 vulnerabilities (7 moderate, 11 high, 2 critical)
5:40:56 PM: To address issues that do not require attention, run:
5:40:56 PM: npm audit fix
5:40:56 PM: To address all issues possible (including breaking changes), run:
5:40:56 PM: npm audit fix --force
5:40:56 PM: Some issues need review, and may require choosing
5:40:56 PM: a different dependency.
5:40:56 PM: Run npm audit for details.
5:40:56 PM: npm packages installed
5:40:56 PM: Successfully installed dependencies
5:40:56 PM: Starting build script
5:40:59 PM: Detected 1 framework(s)
5:40:59 PM: “create-react-app” at version “5.0.1”
5:40:59 PM: Section completed: initializing
5:41:01 PM: ​
5:41:01 PM: Netlify Build
5:41:01 PM: ────────────────────────────────────────────────────────────────
5:41:01 PM: ​
5:41:01 PM: ❯ Version
5:41:01 PM: netlify/build 29.36.3
5:41:01 PM: ​
5:41:01 PM: ❯ Flags
5:41:01 PM: baseRelDir: true
5:41:01 PM: buildId: 65fa05ef06f31c27f1742683
5:41:01 PM: deployId: 65fa05ef06f31c27f1742685
5:41:01 PM: ​
5:41:01 PM: ❯ Current directory
5:41:01 PM: /opt/build/repo
5:41:01 PM: ​
5:41:01 PM: ❯ Config file
5:41:01 PM: No config file was defined: using default values.
5:41:01 PM: ​
5:41:01 PM: ❯ Context
5:41:01 PM: production
5:41:01 PM: ​
5:41:01 PM: Build command from Netlify app
5:41:01 PM: ────────────────────────────────────────────────────────────────
5:41:01 PM: ​
5:41:01 PM: $ npm run buil
5:41:01 PM: > animals0.1.0 build
5:41:01 PM: > react-scripts build
5:41:02 PM: Creating an optimized production build…
5:41:05 PM: One of your dependencies, babel-preset-react-app, is importing the
5:41:05 PM: “babel/plugin-proposal-private-property-in-object” package without
5:41:05 PM: declaring it in its dependencies. This is currently working because
5:41:05 PM: “babel/plugin-proposal-private-property-in-object” is already in your
5:41:05 PM: node_modules folder for unrelated reasons, but it may break at any time.
5:41:05 PM: babel-preset-react-app is part of the create-react-app project, which
5:41:05 PM: is not maintianed anymore. It is thus unlikely that this bug will
5:41:05 PM: ever be fixed. Add “babel/plugin-proposal-private-property-in-object” to
5:41:05 PM: your devDependencies to work around this error. This will make this message
5:41:05 PM: go away.
5:41:11 PM: Failed during stage “building site”: Build script returned non-zero exit code: 2
5:41:11 PM:
5:41:11 PM: Treating warnings as errors because process.env.CI = true.
5:41:11 PM: Most CI servers set it automatically.
5:41:11 PM:
5:41:11 PM: Failed to compile.
5:41:11 PM:
5:41:11 PM: [eslint]
5:41:11 PM: src/Pages/Home.js
5:41:11 PM: Line 1:8: “hug2” is defined but never used no-unused-vars
5:41:11 PM: Line 14:8: “car2” is defined but never used no-unused-vars
5:41:11 PM: Line 15:8: “car” is defined but never used no-unused-vars
5:41:11 PM: Line 16:8: “flex” is defined but never used no-unused-vars
5:41:11 PM: Line 17:8: “image1” is defined but never used no-unused-vars
5:41:11 PM: src/Pages/Valentines.js
5:41:11 PM: Line 17:15: Unexpected empty object pattern no-empty-pattern
5:41:11 PM: src/Pages/main.js
5:41:11 PM: Line 21:15: Unexpected empty object pattern no-empty-pattern
5:41:11 PM: Line 30:13: “AudioStopClick” is assigned a value but never used no-unused-vars
5:41:11 PM: ​
5:41:11 PM: “build.command” failed
5:41:11 PM: ────────────────────────────────────────────────────────────────
5:41:11 PM: ​
5:41:11 PM: Error message
5:41:11 PM: Command failed with exit code 1: npm run build (https ntl.fyi/exit-code-1)
5:41:11 PM: ​
5:41:11 PM: Error location
5:41:11 PM: In Build command from Netlify app:
5:41:11 PM: npm run build
5:41:11 PM: ​
5:41:11 PM: Resolved config
5:41:11 PM: build:
5:41:11 PM: command: npm run build
5:41:11 PM: commandOrigin: ui
5:41:11 PM: publish: /opt/build/repo/build
5:41:11 PM: publishOrigin: ui
5:41:11 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:41:11 PM: Failing build: Failed to build site
5:41:11 PM: Finished processing build request in 1m12.172s

please help me solve this!

@Maya2234 Change your Build command to CI= npm run build

This is explained in many threads, but I explained it again recently in detail here:

I am sorry for the confusion, and I appreciate your help

I do have one more question, I am very confused because I own a domain and put it into my site, but when I click on my successfully build production, it has a completely different url- the site name, shouldn’t those all be related? Thanks

@Maya2234 The documentation for custom domains is here: