I am trying to deploy a react app but I am facing two issues:
- Cannot find module “sass”.
- “build.command” failed
For the second issue I have tried adding the CI= npm run build but the issue still hasn’t been solved.
Here is the deploy log:
11:18:33 PM: build-image version: fcb0c1b3ada6d25c1cb58e8bc514f5f23cc14f15 (focal)
11:18:33 PM: buildbot version: 949f978097ce456b0ebbd6633df01a071000be30
11:18:33 PM: Building without cache
11:18:33 PM: Starting to prepare the repo for build
11:18:34 PM: No cached dependencies found. Cloning fresh repo
11:18:34 PM: git clone --filter=blob:none https://github.com/kkunal026/client
11:18:34 PM: Preparing Git Reference refs/heads/master
11:18:37 PM: Starting to install dependencies
11:18:39 PM: Python version set to 3.8
11:18:40 PM: Attempting Ruby version 2.7.2, read from environment
11:18:40 PM: Using Ruby version 2.7.2
11:18:41 PM: Started restoring cached go cache
11:18:41 PM: Finished restoring cached go cache
11:18:42 PM: go version go1.19.13 linux/amd64
11:18:43 PM: Using PHP version 8.0
11:18:44 PM: Downloading and installing node v18.19.1...
11:18:45 PM: Downloading https://nodejs.org/dist/v18.19.1/node-v18.19.1-linux-x64.tar.xz...
11:18:45 PM: Computing checksum with sha256sum
11:18:45 PM: Checksums matched!
11:18:47 PM: Now using node v18.19.1 (npm v10.2.4)
11:18:47 PM: Enabling Node.js Corepack
11:18:47 PM: Started restoring cached build plugins
11:18:47 PM: Finished restoring cached build plugins
11:18:47 PM: Started restoring cached corepack dependencies
11:18:47 PM: Finished restoring cached corepack dependencies
11:18:47 PM: No npm workspaces detected
11:18:47 PM: Started restoring cached node modules
11:18:47 PM: Finished restoring cached node modules
11:18:48 PM: Installing npm packages using npm version 10.2.4
11:18:58 PM: npm WARN deprecated @babel/plugin-proposal-numeric-separator@7.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.
11:18:58 PM: npm WARN deprecated @babel/plugin-proposal-nullish-coalescing-operator@7.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.
11:18:58 PM: npm WARN deprecated @babel/plugin-proposal-private-methods@7.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.
11:18:58 PM: npm WARN deprecated @babel/plugin-proposal-class-properties@7.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.
11:18:58 PM: npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
11:18:58 PM: npm WARN deprecated abab@2.0.6: Use your platform"s native atob() and btoa() methods instead
npm WARN deprecated domexception@2.0.1: Use your platform"s native DOMException instead
npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
11:18:58 PM: npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
11:18:58 PM: npm WARN deprecated @babel/plugin-proposal-private-property-in-object@7.21.11: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-property-in-object instead.
11:18:58 PM: npm WARN deprecated w3c-hr-time@1.0.2: Use your platform"s native performance.now() and performance.timeOrigin.
npm WARN deprecated @babel/plugin-proposal-optional-chaining@7.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.
11:18:59 PM: npm WARN deprecated workbox-cacheable-response@6.6.0: workbox-background-sync@6.6.0
11:19:00 PM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
11:19:07 PM: added 1628 packages, and audited 1629 packages in 19s
11:19:07 PM: 269 packages are looking for funding
11:19:07 PM: run `npm fund` for details
11:19:07 PM: 8 vulnerabilities (2 moderate, 6 high)
11:19:07 PM: To address all issues (including breaking changes), run:
11:19:07 PM: npm audit fix --force
11:19:07 PM: Run `npm audit` for details.
11:19:07 PM: npm packages installed
11:19:08 PM: Successfully installed dependencies
11:19:08 PM: Starting build script
11:19:11 PM: Detected 1 framework(s)
11:19:11 PM: "create-react-app" at version "5.0.1"
11:19:11 PM: Section completed: initializing
11:19:12 PM:
11:19:12 PM: Netlify Build
11:19:12 PM: ────────────────────────────────────────────────────────────────
11:19:12 PM:
11:19:12 PM: ❯ Version
11:19:12 PM: @netlify/build 29.36.0
11:19:12 PM:
11:19:12 PM: ❯ Flags
11:19:12 PM: baseRelDir: true
11:19:12 PM: buildId: 65e4b7e67dacf1b117f9788c
11:19:12 PM: deployId: 65e4b7e67dacf1b117f9788e
11:19:12 PM:
11:19:12 PM: ❯ Current directory
11:19:12 PM: /opt/build/repo
11:19:12 PM:
11:19:12 PM: ❯ Config file
11:19:12 PM: No config file was defined: using default values.
11:19:12 PM:
11:19:12 PM: ❯ Context
11:19:12 PM: production
11:19:12 PM:
11:19:12 PM: Build command from Netlify app
11:19:12 PM: ────────────────────────────────────────────────────────────────
11:19:12 PM:
11:19:12 PM: $ CI= npm run build
11:19:12 PM: > client@0.1.0 build
11:19:12 PM: > react-scripts build
11:19:13 PM: Creating an optimized production build...
11:19:22 PM: Failed during stage "building site": Build script returned non-zero exit code: 2
11:19:22 PM: Failed to compile.
11:19:22 PM:
11:19:22 PM: Cannot find module "sass"
11:19:22 PM: Require stack:
11:19:22 PM: - /opt/build/repo/node_modules/sass-loader/dist/utils.js
11:19:22 PM: - /opt/build/repo/node_modules/sass-loader/dist/index.js
11:19:22 PM: - /opt/build/repo/node_modules/sass-loader/dist/cjs.js
11:19:22 PM: - /opt/build/repo/node_modules/loader-runner/lib/loadLoader.js
11:19:22 PM: - /opt/build/repo/node_modules/loader-runner/lib/LoaderRunner.js
11:19:22 PM: - /opt/build/repo/node_modules/webpack/lib/NormalModule.js
11:19:22 PM: - /opt/build/repo/node_modules/webpack-manifest-plugin/dist/index.js
11:19:22 PM: - /opt/build/repo/node_modules/react-scripts/config/webpack.config.js
11:19:22 PM: - /opt/build/repo/node_modules/react-scripts/scripts/build.js
11:19:22 PM:
11:19:22 PM: "build.command" failed
11:19:22 PM: ────────────────────────────────────────────────────────────────
11:19:22 PM:
11:19:22 PM: Error message
11:19:22 PM: Command failed with exit code 1: CI= npm run build (https://ntl.fyi/exit-code-1)
11:19:22 PM:
11:19:22 PM: Error location
11:19:22 PM: In Build command from Netlify app:
11:19:22 PM: CI= npm run build
11:19:22 PM:
11:19:22 PM: Resolved config
11:19:22 PM: build:
11:19:22 PM: command: CI= npm run build
11:19:22 PM: commandOrigin: ui
11:19:22 PM: environment:
11:19:22 PM: - CI
11:19:22 PM: - NPM_FLAGS
11:19:22 PM: publish: /opt/build/repo/build
11:19:22 PM: publishOrigin: ui
11:19:22 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:19:22 PM: Failing build: Failed to build site
11:19:23 PM: Finished processing build request in 49.229s
Pls help me solve this problem