Deploy failed due to an error in @netlify/plugin-gatsby plugin

Hey there! I’m trying to host my gatsby website on netlify but i’m facing an error for failed a plugin. I’ve tried to rebuild node-sass using npm rebuild command. I’ve tried deleting the folder from node_modules and installing it again but doesn’t help.

Summary of Problem

LOG

1:20:08 PM: Waiting for other deploys from your team to complete. Check the queue: Netlify App
1:21:07 PM: build-image version: a2d22d22e4555d1ef0a972ed14a0a4b366ad20c4 (focal)
1:21:07 PM: build-image tag: v4.16.3
1:21:07 PM: buildbot version: 9a6b4d0d37eb2a90e2c482e1d6cfe9a0793e6262
1:21:07 PM: Fetching cached dependencies
1:21:07 PM: Failed to fetch cache, continuing with build
1:21:07 PM: Starting to prepare the repo for build
1:21:07 PM: No cached dependencies found. Cloning fresh repo
1:21:07 PM: git clone --filter=blob:none https://github.com/JarrarShah/Cloud9
1:21:08 PM: Preparing Git Reference refs/heads/develop
1:21:09 PM: Parsing package.json dependencies
1:21:10 PM: Starting build script
1:21:10 PM: Installing dependencies
1:21:10 PM: Python version set to 2.7
1:21:10 PM: Attempting Node.js version ‘18.12.1’ from .nvmrc
1:21:11 PM: Downloading and installing node v18.12.1…
1:21:11 PM: Downloading https://nodejs.org/dist/v18.12.1/node-v18.12.1-linux-x64.tar.xz
1:21:11 PM: Computing checksum with sha256sum
1:21:11 PM: Checksums matched!
1:21:13 PM: Now using node v18.12.1 (npm v8.19.2)
1:21:13 PM: Enabling Node.js Corepack
1:21:14 PM: Started restoring cached build plugins
1:21:14 PM: Finished restoring cached build plugins
1:21:14 PM: Attempting Ruby version 2.7.2, read from environment
1:21:14 PM: Using Ruby version 2.7.2
1:21:14 PM: Using PHP version 8.0
1:21:14 PM: Started restoring cached corepack dependencies
1:21:14 PM: mv: cannot move ‘/opt/build/cache/.node/corepack’ to ‘/opt/buildhome/.node/corepack’: No such file or directory
1:21:14 PM: Finished restoring cached corepack dependencies
1:21:14 PM: No npm workspaces detected
1:21:14 PM: Started restoring cached node modules
1:21:14 PM: Finished restoring cached node modules
1:21:14 PM: Bypassing sha validation. Running pre & post install scripts
1:21:15 PM: Installing npm packages using npm version 8.19.2
1:21:16 PM: npm WARN ERESOLVE overriding peer dependency
1:21:16 PM: npm WARN While resolving: react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
1:21:16 PM: npm WARN Found: react@18.2.0
1:21:16 PM: npm WARN node_modules/react
1:21:16 PM: npm WARN react@“^18.2.0” from the root project
1:21:16 PM: npm WARN 19 more (@gatsbyjs/reach-router, @react-aria/ssr, …)
1:21:16 PM: npm WARN
1:21:16 PM: npm WARN Could not resolve dependency:
1:21:16 PM: npm WARN peer react@“0.0.0-experimental-c8b778b7f-20220825” from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
1:21:16 PM: npm WARN node_modules/react-server-dom-webpack
1:21:16 PM: npm WARN react-server-dom-webpack@“0.0.0-experimental-c8b778b7f-20220825” from gatsby@5.3.3
1:21:16 PM: npm WARN node_modules/gatsby
1:21:16 PM: npm WARN
1:21:16 PM: npm WARN Conflicting peer dependency: react@0.0.0-experimental-c8b778b7f-20220825
1:21:16 PM: npm WARN node_modules/react
1:21:16 PM: npm WARN peer react@“0.0.0-experimental-c8b778b7f-20220825” from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
1:21:16 PM: npm WARN node_modules/react-server-dom-webpack
1:21:16 PM: npm WARN react-server-dom-webpack@“0.0.0-experimental-c8b778b7f-20220825” from gatsby@5.3.3
1:21:16 PM: npm WARN node_modules/gatsby
1:21:32 PM: npm WARN deprecated @types/keyv@4.2.0: This is a stub types definition. keyv provides its own type definitions, so you do not need this installed.
1:21:51 PM: added 1554 packages, and audited 1555 packages in 36s
1:21:51 PM: 228 packages are looking for funding
1:21:51 PM: run npm fund for details
1:21:51 PM: 3 moderate severity vulnerabilities
1:21:51 PM: To address all issues, run:
1:21:51 PM: npm audit fix
1:21:51 PM: Run npm audit for details.
1:21:51 PM: npm packages installed
1:21:52 PM: Started restoring cached go cache
1:21:52 PM: Finished restoring cached go cache
1:21:52 PM: go version go1.19.4 linux/amd64
1:21:52 PM: Detected 1 framework(s)
1:21:52 PM: “gatsby” at version “5.3.3”
1:21:52 PM: Installing missing commands
1:21:52 PM: Verify run directory
1:21:52 PM: Section completed: initializing
1:21:53 PM: ​
1:21:53 PM: Netlify Build
1:21:53 PM: ────────────────────────────────────────────────────────────────
1:21:53 PM: ​
1:21:53 PM: ❯ Version
1:21:53 PM: @netlify/build 29.4.1
1:21:53 PM: ​
1:21:53 PM: ❯ Flags
1:21:53 PM: baseRelDir: true
1:21:53 PM: buildId: 63bfc2b8d6be88000a4b05b2
1:21:53 PM: deployId: 63bfc2b8d6be88000a4b05b4
1:21:53 PM: ​
1:21:53 PM: ❯ Current directory
1:21:53 PM: /opt/build/repo
1:21:53 PM: ​
1:21:53 PM: ❯ Config file
1:21:53 PM: No config file was defined: using default values.
1:21:53 PM: ​
1:21:53 PM: ❯ Context
1:21:53 PM: production
1:21:54 PM: ​
1:21:54 PM: ❯ Installing plugins
1:21:54 PM: - @netlify/plugin-gatsby@3.4.8
1:22:02 PM: ​
1:22:02 PM: ❯ Loading plugins
1:22:02 PM: - @netlify/plugin-gatsby@3.4.8 from Netlify app
1:22:03 PM: ​
1:22:03 PM: 1. @netlify/plugin-gatsby (onPreBuild event)
1:22:03 PM: ────────────────────────────────────────────────────────────────
1:22:03 PM: ​
1:22:03 PM: No Gatsby cache found. Building fresh.
1:22:03 PM: ​
1:22:03 PM: Plugin “@netlify/plugin-gatsby” failed
1:22:03 PM: ────────────────────────────────────────────────────────────────
1:22:03 PM: ​
1:22:03 PM: Error message
1:22:03 PM: Error: Could not load gatsby-config.js
1:22:03 PM: Missing binding /opt/build/repo/node_modules/node-sass/vendor/linux-x64-93/binding.node
1:22:03 PM: Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 16.x
1:22:03 PM: ​
1:22:03 PM: Found bindings for the following environments:
1:22:03 PM: - OS X 64-bit with Node.js 18.x
1:22:03 PM: - OS X 64-bit with Node.js 19.x
1:22:03 PM: - OS X 64-bit with Node.js 16.x
1:22:03 PM: - Linux 64-bit with Node.js 18.x
1:22:03 PM: ​
1:22:03 PM: This usually happens because your environment has changed since running npm install.
1:22:03 PM: Run npm rebuild node-sass to download the binding for your current environment.
1:22:03 PM: ​
1:22:03 PM: Plugin details
1:22:03 PM: Package: @netlify/plugin-gatsby
1:22:03 PM: Version: 3.4.8
1:22:03 PM: Repository: git+https://github.com/netlify/netlify-plugin-gatsby.git
1:22:03 PM: npm link: @netlify/plugin-gatsby - npm
1:22:03 PM: Report issues: Issues · netlify/netlify-plugin-gatsby · GitHub
1:22:03 PM: ​
1:22:03 PM: Error location
1:22:03 PM: In “onPreBuild” event in “@netlify/plugin-gatsby” from Netlify app
1:22:03 PM: ​
1:22:03 PM: Resolved config
1:22:03 PM: build:
1:22:03 PM: command: gatsby build
1:22:03 PM: commandOrigin: ui
1:22:03 PM: environment:
1:22:03 PM: - NODE_VERSION
1:22:03 PM: publish: /opt/build/repo/public
1:22:03 PM: publishOrigin: ui
1:22:03 PM: plugins:
1:22:03 PM: - inputs: {}
1:22:03 PM: origin: ui
1:22:03 PM: package: ‘@netlify/plugin-gatsby’
1:22:05 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
1:22:04 PM: Caching artifacts
1:22:04 PM: Started saving node modules
1:22:04 PM: Finished saving node modules
1:22:04 PM: Started saving build plugins
1:22:04 PM: Finished saving build plugins
1:22:04 PM: Started saving pip cache
1:22:04 PM: Finished saving pip cache
1:22:04 PM: Started saving emacs cask dependencies
1:22:04 PM: Finished saving emacs cask dependencies
1:22:04 PM: Started saving maven dependencies
1:22:04 PM: Finished saving maven dependencies
1:22:04 PM: Started saving boot dependencies
1:22:04 PM: Finished saving boot dependencies
1:22:04 PM: Started saving rust rustup cache
1:22:04 PM: Finished saving rust rustup cache
1:22:04 PM: Started saving go dependencies
1:22:04 PM: Finished saving go dependencies
1:22:05 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:22:05 PM: Failing build: Failed to build site
1:22:05 PM: Finished processing build request in 58.6153466s

I think this is the actual problem. You don’t have any gatsby-config.js.