Sharp-linux-x64.node: undefined symbol: vips_fail_on_get_type

Hi,

Getting this error when trying to build https://pq-frontend.netlify.app/ “sharp-linux-x64.node: undefined symbol: vips_fail_on_get_type”

I had to update gatsby-source-wordpress and gatsby npm packages. It runs fine on my local pc but fails on netlify. The culprit seems to be the sharp package.

I’ve tried different node and npm versions, different version of sharp plugins etc

Here is the deploy log Netlify App

7:16:15 AM: build-image version: a968751fa4fa5480005f9e300e07554d2cf87d06 (focal)
7:16:15 AM: buildbot version: 8b65fed9bc22a54aead1b50de89fea883757023a
7:16:15 AM: Fetching cached dependencies
7:16:15 AM: Starting to download cache of 445.4MB
7:16:19 AM: Finished downloading cache in 4.101s
7:16:19 AM: Starting to extract cache
7:16:21 AM: Finished extracting cache in 1.914s
7:16:21 AM: Finished fetching cache in 6.081s
7:16:21 AM: Starting to prepare the repo for build
7:16:21 AM: Preparing Git Reference refs/heads/master
7:16:24 AM: Parsing package.json dependencies
7:16:25 AM: Starting to install dependencies
7:16:25 AM: Python version set to 3.8
7:16:25 AM: Attempting Ruby version 2.7.2, read from environment
7:16:26 AM: Using Ruby version 2.7.2
7:16:26 AM: Started restoring cached go cache
7:16:26 AM: Finished restoring cached go cache
7:16:26 AM: Installing Go version 1.19.5 (requested 1.19.5)
7:16:30 AM: go version go1.19.5 linux/amd64
7:16:31 AM: Using PHP version 8.0
7:16:31 AM: Started restoring cached Node.js version
7:16:32 AM: Finished restoring cached Node.js version
7:16:32 AM: Downloading and installing node v18.16.0…
7:16:32 AM: Downloading https://nodejs.org/dist/v18.16.0/node-v18.16.0-linux-x64.tar.xz
7:16:33 AM: Computing checksum with sha256sum
7:16:33 AM: Checksums matched!
7:16:35 AM: Now using node v18.16.0 (npm v9.5.1)
7:16:35 AM: Enabling Node.js Corepack
7:16:35 AM: Started restoring cached build plugins
7:16:35 AM: Finished restoring cached build plugins
7:16:35 AM: Started restoring cached corepack dependencies
7:16:35 AM: Finished restoring cached corepack dependencies
7:16:35 AM: No npm workspaces detected
7:16:35 AM: Started restoring cached node modules
7:16:35 AM: Finished restoring cached node modules
7:16:35 AM: Installing npm packages using npm version 9.5.1
7:16:37 AM: npm WARN old lockfile
7:16:37 AM: npm WARN old lockfile The package-lock.json file was created with an old version of npm,
7:16:37 AM: npm WARN old lockfile so supplemental metadata must be fetched from the registry.
7:16:37 AM: npm WARN old lockfile
7:16:37 AM: npm WARN old lockfile This is a one-time fix-up, please be patient…
7:16:37 AM: npm WARN old lockfile
7:16:50 AM: npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
7:16:51 AM: npm WARN deprecated subscriptions-transport-ws@0.9.19: The subscriptions-transport-ws package is no longer maintained. We recommend you use graphql-ws instead. For help migrating Apollo software to graphql-ws, see For general help using graphql-ws, see
7:16:56 AM: npm WARN deprecated express-graphql@0.12.0: This package is no longer maintained. We recommend using graphql-http instead. Please consult the migration document
7:17:14 AM: added 810 packages, removed 505 packages, changed 660 packages, and audited 2847 packages in 38s
7:17:14 AM: 342 packages are looking for funding
7:17:14 AM: run npm fund for details
7:17:14 AM: 87 vulnerabilities (1 low, 35 moderate, 43 high, 8 critical)
7:17:14 AM: To address issues that do not require attention, run:
7:17:14 AM: npm audit fix
7:17:14 AM: To address all issues possible (including breaking changes), run:
7:17:14 AM: npm audit fix --force
7:17:14 AM: Some issues need review, and may require choosing
7:17:14 AM: a different dependency.
7:17:14 AM: Run npm audit for details.
7:17:14 AM: npm packages installed
7:17:14 AM: Install dependencies script success
7:17:14 AM: Starting build script
7:17:15 AM: Detected 1 framework(s)
7:17:15 AM: “gatsby” at version “3.0.0”
7:17:15 AM: Section completed: initializing
7:17:16 AM: ​
7:17:16 AM: Netlify Build
7:17:16 AM: ────────────────────────────────────────────────────────────────
7:17:16 AM: ​
7:17:16 AM: ❯ Version
7:17:16 AM: @netlify/build 29.10.1
7:17:16 AM: ​
7:17:16 AM: ❯ Flags
7:17:16 AM: baseRelDir: true
7:17:16 AM: buildId: 6451e00b15087e0008cd8818
7:17:16 AM: deployId: 6451e00b15087e0008cd881a
7:17:16 AM: ​
7:17:16 AM: ❯ Current directory
7:17:16 AM: /opt/build/repo
7:17:16 AM: ​
7:17:16 AM: ❯ Config file
7:17:16 AM: No config file was defined: using default values.
7:17:16 AM: ​
7:17:16 AM: ❯ Context
7:17:16 AM: production
7:17:16 AM: ​
7:17:16 AM: 1. Build command from Netlify app
7:17:16 AM: ────────────────────────────────────────────────────────────────
7:17:16 AM: ​
7:17:16 AM: $ npm run cbuild
7:17:17 AM: > gatsby-starter-wordpress-twenty-twenty@0.0.1 cbuild
7:17:17 AM: > gatsby clean && gatsby build
7:17:17 AM: info Deleting .cache, public, /opt/build/repo/node_modules/.cache/babel-loader, /opt/build/repo/node_modules/.cache/terser-webpack-plugin
7:17:17 AM: info Successfully deleted directories
7:17:19 AM: success open and validate gatsby-configs - 0.045s
7:17:19 AM: warning Warning: there are unknown plugin options for “gatsby-source-wordpress”: protocol, includedRoutes
7:17:19 AM: Please open an issue at GitHub - gatsbyjs/gatsby: The fastest frontend for the headless web. Build modern websites with React. if you believe this option is valid.
7:17:19 AM: warning Plugin gatsby-source-filesystem is not compatible with your gatsby version 3.0.0 - It requires gatsby@^2.2.0
7:17:19 AM: warning Plugin gatsby-plugin-netlify-cache is not compatible with your gatsby version 3.0.0 - It requires gatsby@^2.0.0
7:17:19 AM: warning Plugin gatsby-plugin-catch-links is not compatible with your gatsby version 3.0.0 - It requires gatsby@^5.0.0-next
7:17:19 AM: warning Plugin gatsby-source-wordpress is not compatible with your gatsby version 3.0.0 - It requires gatsby@^5.0.0-next
7:17:19 AM: warning Plugin gatsby-transformer-sharp is not compatible with your gatsby version 3.0.0 - It requires gatsby@^2.12.1
7:17:20 AM: error Your plugins must export known APIs from their gatsby-node.js.
7:17:20 AM: See for the list of Gatsby node APIs.
7:17:20 AM: - The plugin gatsby-source-wordpress@7.9.0 is using the API “onPluginInit” which was introduced in gatsby@3.9.0.
7:17:20 AM: Some of the following may help fix the error(s):
7:17:20 AM: - npm install gatsby@^3.9.0
7:17:20 AM: - Rename “onPluginInit” → “onPreInit”
7:17:20 AM: success load plugins - 1.116s
7:17:20 AM: plugin-netlify-cache: Restoring 51 cached files for .cache directory with 0 already existing files.
7:17:21 AM: plugin-netlify-cache: Netlify cache restored
7:17:21 AM: success onPreInit - 0.871s
7:17:21 AM: info We’ve detected that the Gatsby cache is incomplete (the .cache directory existsbut the public directory does not). As a precaution, we’re deleting your site’s
7:17:21 AM: cache to ensure there’s no stale data.success initialize cache - 0.123s
7:17:21 AM: success copy gatsby files - 0.025s
7:17:21 AM: success onPreBootstrap - 0.007s
7:17:22 AM: success gatsby-source-wordpress ensuring plugin requirements are met - 0.938s
7:17:22 AM: ⠀
7:17:22 AM: info gatsby-source-wordpress
7:17:22 AM: This is either your first build or the cache was cleared.
7:17:22 AM: Please wait while your WordPress data is synced to your Gatsby cache.
7:17:22 AM: Maybe now’s a good time to get up and stretch? :smiley:
7:17:24 AM: success gatsby-source-wordpress writing GraphQL queries to disk at ./WordPress/GraphQL/ - 0.359s
7:17:24 AM: success gatsby-source-wordpress ingest WPGraphQL schema - 1.967s
7:17:24 AM: success createSchemaCustomization - 2.940s
7:17:24 AM: success gatsby-source-wordpress fetch root fields - 0.562s
7:17:26 AM: success gatsby-source-wordpress Comment - 2.071s - fetched 42
7:17:27 AM: success gatsby-source-wordpress FAQ - 3.398s - fetched 55
7:17:27 AM: success gatsby-source-wordpress Department - 3.611s - fetched 5
7:17:31 AM: success gatsby-source-wordpress ContentType - 7.251s - fetched 7
7:18:17 AM: success gatsby-source-wordpress Category - 52.746s - fetched 472
7:18:17 AM: success gatsby-source-wordpress JobOpportunity - 0.743s - fetched 6
7:18:18 AM: success gatsby-source-wordpress GfEntry - 1.116s - fetched 0
7:18:18 AM: success gatsby-source-wordpress GfSubmittedEntry - 1.625s - fetched 0
7:18:19 AM: success gatsby-source-wordpress GfForm - 2.113s - fetched 0
7:18:19 AM: success gatsby-source-wordpress Menu - 0.483s - fetched 2
7:18:19 AM: success gatsby-source-wordpress PostFormat - 0.540s - fetched 1
7:18:20 AM: success gatsby-source-wordpress MenuItem - 0.822s - fetched 37
7:18:22 AM: success gatsby-source-wordpress Page - 3.161s - fetched 31
7:18:45 AM: success gatsby-source-wordpress Post - 26.336s - fetched 528
7:18:45 AM: success gatsby-source-wordpress Taxonomy - 0.337s - fetched 4
7:18:45 AM: success gatsby-source-wordpress UserRole - 0.341s - fetched 0
7:18:46 AM: success gatsby-source-wordpress Testimonial - 0.898s - fetched 21
7:18:47 AM: success gatsby-source-wordpress TeamMember - 2.011s - fetched 53
7:19:29 AM: success gatsby-source-wordpress Tag - 44.160s - fetched 839
7:19:32 AM: success gatsby-source-wordpress User - 2.629s - fetched 63
7:23:15 AM: node: symbol lookup error: /opt/build/repo/node_modules/sharp/build/Release/sharp-linux-x64.node: undefined symbol: vips_fail_on_get_type
7:23:15 AM: ​
7:23:15 AM: “build.command” failed
7:23:15 AM: ────────────────────────────────────────────────────────────────
7:23:15 AM: ​
7:23:15 AM: Error message
7:23:15 AM: Command failed with exit code 127: npm run cbuild (Search results for '"non-zero exit code: 127"' - Netlify Support Forums)
7:23:15 AM: ​
7:23:15 AM: Error location
7:23:15 AM: In Build command from Netlify app:
7:23:15 AM: npm run cbuild
7:23:15 AM: ​
7:23:15 AM: Resolved config
7:23:15 AM: build:
7:23:15 AM: command: npm run cbuild
7:23:15 AM: commandOrigin: ui
7:23:15 AM: environment:
7:23:15 AM: - GATSBY_SITE_URL
7:23:15 AM: - GRAVITYFORM_KEY
7:23:15 AM: - GRAVITYFORM_SECRET
7:23:15 AM: - NODE_VERSION
7:23:15 AM: - RECAPTCHA_SITE_KEY
7:23:15 AM: - WPGRAPHQL_URL
7:23:15 AM: - WP_BASE_URL
7:23:15 AM: publish: /opt/build/repo/public
7:23:15 AM: publishOrigin: ui
7:23:15 AM: Caching artifacts
7:23:15 AM: Started saving node modules
7:23:15 AM: Finished saving node modules
7:23:15 AM: Started saving build plugins
7:23:15 AM: Finished saving build plugins
7:23:15 AM: Started saving corepack cache
7:23:15 AM: Finished saving corepack cache
7:23:15 AM: Started saving pip cache
7:23:15 AM: Finished saving pip cache
7:23:15 AM: Started saving emacs cask dependencies
7:23:15 AM: Finished saving emacs cask dependencies
7:23:15 AM: Started saving maven dependencies
7:23:15 AM: Finished saving maven dependencies
7:23:15 AM: Started saving boot dependencies
7:23:15 AM: Finished saving boot dependencies
7:23:15 AM: Started saving rust rustup cache
7:23:15 AM: Finished saving rust rustup cache
7:23:15 AM: Started saving go dependencies
7:23:15 AM: Finished saving go dependencies
7:23:17 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
7:23:17 AM: Failing build: Failed to build site
7:23:17 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
7:23:17 AM: Finished processing build request in 7m2.557s

Any help is appreciated.

Thanks

This is what your developer console looks like:

Have you tried the solution outlined here.