Plugin "@netlify/plugin-gatsby" failed Error

Howdy,

My Netlify site name is nervous-elion-083963 and I am experiencing a build error that has just come up today. The deploy summary in Netlify states the following:

Plugin "@netlify/plugin-gatsby" failed

Error: Could not load gatsby-config.js
Missing binding /opt/build/repo/node_modules/node-sass/vendor/linux-x64-93/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 16.x


Found bindings for the following environments:



Linux 64-bit with Node.js 14.x

This usually happens because your environment has changed since running npm install.
Run npm rebuild node-sass to download the binding for your current environment.

In "onPreBuild" event in "@netlify/plugin-gatsby" from undefined

Below is a full screenshot of the Deploy Log:

Any assistance in what might be causing this error on deploy would be appreciated. My development setup is still working locally, and I am able to build locally.

Thank you for any assistance!

Try upgrading your Node Version to Node 16 and create your package-lock.json again.

@hrishikesh, from what I understand, everything should be up to date after changing my .nvmrc file to v16.15.1 as I am using locally, but I am still getting the following error upon pushing to Netlify:

Plugin "@netlify/plugin-gatsby" failed

Error: Could not load gatsby-config.js
Missing binding /opt/build/repo/node_modules/node-sass/vendor/linux-x64-93/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 16.x

Found bindings for the following environments:

Linux 64-bit with Node.js 14.x

This usually happens because your environment has changed since running npm install.
Run npm rebuild node-sass to download the binding for your current environment.

In "onPreBuild" event in "@netlify/plugin-gatsby" from undefined

This is my full deploy log from my latest push:

2:37:49 PM: build-image version: 6fd4b129abc97418b4cd2d48c553dd4a014a6965 (focal)
2:37:49 PM: buildbot version: 6fd4b129abc97418b4cd2d48c553dd4a014a6965
2:37:49 PM: Fetching cached dependencies
2:37:49 PM: Starting to download cache of 188.2MB
2:37:50 PM: Finished downloading cache in 1.121s
2:37:50 PM: Starting to extract cache
2:37:53 PM: Finished extracting cache in 2.855s
2:37:53 PM: Finished fetching cache in 4.031s
2:37:53 PM: Starting to prepare the repo for build
2:37:53 PM: Preparing Git Reference refs/heads/master
2:37:54 PM: Parsing package.json dependencies
2:37:56 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus '/public' in the Netlify UI
2:37:56 PM: Starting build script
2:37:56 PM: Installing dependencies
2:37:56 PM: Python version set to 2.7
2:37:56 PM: Started restoring cached Node.js version
2:37:57 PM: Finished restoring cached Node.js version
2:37:57 PM: Attempting Node.js version 'v16.15.1' from .nvmrc
2:37:57 PM: Downloading and installing node v16.15.1...
2:37:57 PM: Downloading https://nodejs.org/dist/v16.15.1/node-v16.15.1-linux-x64.tar.xz...
2:37:57 PM: Computing checksum with sha256sum
2:37:57 PM: Checksums matched!
2:37:59 PM: Now using node v16.15.1 (npm v8.11.0)
2:37:59 PM: Enabling Node.js Corepack
2:37:59 PM: Started restoring cached build plugins
2:37:59 PM: Finished restoring cached build plugins
2:38:00 PM: Attempting Ruby version 2.6.2, read from environment
2:38:00 PM: Started restoring cached Ruby version
2:38:00 PM: Finished restoring cached Ruby version
2:38:00 PM: Using Ruby version 2.6.2
2:38:00 PM: Using PHP version 8.0
2:38:00 PM: Started restoring cached corepack dependencies
2:38:00 PM: Finished restoring cached corepack dependencies
2:38:00 PM: No npm workspaces detected
2:38:00 PM: Started restoring cached node modules
2:38:00 PM: Finished restoring cached node modules
2:38:00 PM: Bypassing sha validation. Running pre & post install scripts
2:38:01 PM: Installing npm packages using npm version 8.11.0
2:38:09 PM: npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
2:38:11 PM: npm WARN deprecated multer@1.4.4: Multer 1.x is affected by CVE-2022-24434. This is fixed in v1.4.4-lts.1 which drops support for versions of Node.js before 6. Please upgrade to at least Node.js 6 and version 1.4.4-lts.1 of Multer. If you need support for older versions of Node.js, we are open to accepting patches that would fix the CVE on the main 1.x release line, whilst maintaining compatibility with Node.js 0.10.
2:38:12 PM: npm WARN deprecated har-validator@5.1.5: this library is no longer supported
2:38:13 PM: npm WARN deprecated formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
2:38:34 PM: added 376 packages, removed 804 packages, changed 636 packages, and audited 2084 packages in 33s
2:38:34 PM: 383 packages are looking for funding
2:38:34 PM:   run `npm fund` for details
2:38:35 PM: 54 vulnerabilities (13 moderate, 36 high, 5 critical)
2:38:35 PM: To address issues that do not require attention, run:
2:38:35 PM:   npm audit fix
2:38:35 PM: To address all issues (including breaking changes), run:
2:38:35 PM:   npm audit fix --force
2:38:35 PM: Run `npm audit` for details.
2:38:35 PM: npm packages installed
2:38:35 PM: Started restoring cached go cache
2:38:35 PM: Finished restoring cached go cache
2:38:35 PM: Installing Go version 1.12 (requested 1.12)
2:38:39 PM: unset GOOS;
2:38:39 PM: unset GOARCH;
2:38:39 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
2:38:39 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
2:38:39 PM: go version >&2;
2:38:39 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.12.linux.amd64.env"
2:38:39 PM: go version go1.12 linux/amd64
2:38:39 PM: Detected 1 framework(s)
2:38:39 PM: "gatsby" at version "3.15.0"
2:38:39 PM: Installing missing commands
2:38:39 PM: Verify run directory
2:38:39 PM: Section completed: initializing
2:38:41 PM: ​
2:38:41 PM:   Netlify Build                                                 
2:38:41 PM: ────────────────────────────────────────────────────────────────
2:38:41 PM: ​
2:38:41 PM: ❯ Version
2:38:41 PM:   @netlify/build 29.5.4
2:38:41 PM: ​
2:38:41 PM: ❯ Flags
2:38:41 PM:   baseRelDir: true
2:38:41 PM:   buildId: 63e0139755eb300009876010
2:38:41 PM:   deployId: 63e0139755eb300009876012
2:38:41 PM: ​
2:38:41 PM: ❯ Current directory
2:38:41 PM:   /opt/build/repo
2:38:41 PM: ​
2:38:41 PM: ❯ Config file
2:38:41 PM:   No config file was defined: using default values.
2:38:41 PM: ​
2:38:41 PM: ❯ Context
2:38:41 PM:   production
2:38:41 PM: ​
2:38:41 PM: ❯ Installing plugins
2:38:41 PM:    - @netlify/plugin-gatsby@3.5.1
2:38:54 PM: ​
2:38:54 PM: ❯ Loading plugins
2:38:54 PM:    - @netlify/plugin-gatsby@3.5.1 from undefined
2:38:55 PM: ​
2:38:55 PM:   1. @netlify/plugin-gatsby (onPreBuild event)                  
2:38:55 PM: ────────────────────────────────────────────────────────────────
2:38:55 PM: ​
2:38:55 PM: No Gatsby cache found. Building fresh.
2:38:55 PM: ​
2:38:55 PM:   Plugin "@netlify/plugin-gatsby" failed                        
2:38:55 PM: ────────────────────────────────────────────────────────────────
2:38:55 PM: ​
2:38:55 PM:   Error message
2:38:55 PM:   Error: Could not load gatsby-config.js
2:38:55 PM:   Missing binding /opt/build/repo/node_modules/node-sass/vendor/linux-x64-93/binding.node
2:38:55 PM:   Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 16.x
2:38:55 PM: ​
2:38:55 PM:   Found bindings for the following environments:
2:38:55 PM:     - Linux 64-bit with Node.js 14.x
2:38:55 PM: ​
2:38:55 PM:   This usually happens because your environment has changed since running `npm install`.
2:38:55 PM:   Run `npm rebuild node-sass` to download the binding for your current environment.
2:38:55 PM: ​
2:38:55 PM:   Plugin details
2:38:55 PM:   Package:        @netlify/plugin-gatsby
2:38:55 PM:   Version:        3.5.1
2:38:55 PM:   Repository:     git+https://github.com/netlify/netlify-plugin-gatsby.git
2:38:55 PM:   npm link:       https://www.npmjs.com/package/@netlify/plugin-gatsby
2:38:55 PM:   Report issues:  https://github.com/netlify/netlify-plugin-gatsby/issues
2:38:55 PM: ​
2:38:55 PM:   Error location
2:38:55 PM:   In "onPreBuild" event in "@netlify/plugin-gatsby" from undefined
2:38:55 PM: ​
2:38:55 PM:   Resolved config
2:38:55 PM:   build:
2:38:55 PM:     command: npm run build
2:38:55 PM:     commandOrigin: ui
2:38:55 PM:     environment:
2:38:55 PM:       - DATO_API_TOKEN
2:38:55 PM:       - NODE_VERSION
2:38:55 PM:       - YARN_FLAGS
2:38:55 PM:     publish: /opt/build/repo/public
2:38:55 PM:     publishOrigin: ui
2:38:55 PM:   plugins:
2:38:55 PM:     - inputs: {}
2:38:55 PM:       package: '@netlify/plugin-gatsby'
2:38:56 PM: Caching artifacts
2:38:56 PM: Started saving node modules
2:38:56 PM: Finished saving node modules
2:38:56 PM: Started saving build plugins
2:38:56 PM: Finished saving build plugins
2:38:56 PM: Started saving corepack cache
2:38:56 PM: Finished saving corepack cache
2:38:56 PM: Started saving pip cache
2:38:56 PM: Finished saving pip cache
2:38:56 PM: Started saving emacs cask dependencies
2:38:56 PM: Finished saving emacs cask dependencies
2:38:56 PM: Started saving maven dependencies
2:38:57 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
2:38:56 PM: Finished saving maven dependencies
2:38:56 PM: Started saving boot dependencies
2:38:56 PM: Finished saving boot dependencies
2:38:56 PM: Started saving rust rustup cache
2:38:56 PM: Finished saving rust rustup cache
2:38:56 PM: Started saving go dependencies
2:38:56 PM: Finished saving go dependencies
2:38:57 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
2:38:57 PM: Failing build: Failed to build site
2:38:58 PM: Finished processing build request in 1m8.902s

My builds are working locally. It is only when pushing to Netlify that these have started failing in the past couple days, and nothing was changed on my end. Is there something else I should know about that Netlify might have changed? This seems to be something on Netlify’s end. Any detailed assistance would be greatly appreciated.

Hi @kory ,

When I check your deploy log it’s show you are not using Node version 16. Can you try and upgrade.

Also can you share your build settings? This usually happens because your environment has changed can you make sure you’re running npm rebuild node-sass to download the binding for your current environment.

I also recommend you give this this support guide a read as it helps with debugging builds.