Gatsby: I am trying to deploy a gatsby project on netlify using github. Everything work fine but at the end i am facing these issue.

Created on 24 Mar 2020  路  11Comments  路  Source: gatsbyjs/gatsby

9:32:45 AM: node: symbol lookup error: /opt/build/repo/node_modules/gatsby-source-contentful/node_modules/sharp/build/Release/sharp.node: undefined symbol: vips_foreign_heif_compression_get_type
9:32:45 AM: Skipping functions preparation step: no functions directory set
9:32:45 AM: Caching artifacts
9:32:45 AM: Started saving node modules
9:32:45 AM: Finished saving node modules
9:32:45 AM: Started saving pip cache
9:32:45 AM: Finished saving pip cache
9:32:45 AM: Started saving emacs cask dependencies
9:32:45 AM: Finished saving emacs cask dependencies
9:32:45 AM: Started saving maven dependencies
9:32:45 AM: Finished saving maven dependencies
9:32:45 AM: Started saving boot dependencies
9:32:45 AM: Finished saving boot dependencies
9:32:45 AM: Started saving go dependencies
9:32:45 AM: Finished saving go dependencies
9:32:48 AM: Error running command: Build script returned non-zero exit code: 127
9:32:48 AM: Failing build: Failed to build site
9:32:49 AM: failed during stage 'building site': Build script returned non-zero exit code: 127
9:32:49 AM: Finished processing build request in 1m36.385195021s

How to fix symbol lookup error: /opt/build/repo/node_modules/gatsby-source-contentful/node_modules/sharp/build/Release/sharp.node: undefined symbol: vips_foreign_heif_compression_get_type

bug

Most helpful comment

@Shashankd48 I had some time to look through the source code for gatsby-plugin-sharp

Try running:

npm uninstall gatsby-plugin-sharp
npm install [email protected]

Then see if you're able to deploy to Netlify.

All 11 comments

Ok, I've encountered this error before when using Docker with Alpine Linux. The issue is you're using version 6.8 8.8.4 of Libvips but Sharp requires 6.9 8.9.1, at least this is the case with Alpine. What operating system are you using??

This is an issue with gatsby-plugin-sharp

Where / How are you trying to deploy the site?

I see now you're trying to deploy to Netlify. What version of Gatsby are you using? Do you have a repo I could attempt to recreate this with?

Operation sust

Ok, I've encountered this error before when using Docker with Alpine Linux. The issue is you're using version ~6.8~ 8.8.4 of Libvips but Sharp requires ~6.9~ 8.9.1, at least this is the case with Alpine. What operating system are you using??

This is an issue with gatsby-plugin-sharp

~Where / How are you trying to deploy the site?~

I see now you're trying to deploy to Netlify. What version of Gatsby are you using? Do you have a repo I could attempt to recreate this with?

Operating system: windows 10 pro

"gatsby-version": "2.19.45"

my public repository: https://github.com/Shashankd48/reactjsecommerseapp

these three environment variable that need to set: on netlify with key

CONTENTFUL_ACCESS_TOKEN=o6GnHATcLyk0rcplA9ZP1gbm-hZTmodDgjsGZB1L7Ac

CONTENTFUL_SPACE_ID=1wfki3n0sy8z

SNIPCART_KEY=Mjg5NTM2MDMtZDRkNi00NzdiLTlkZmUtZjU3ZTM5YTAxNTM2NjM3MjA1NjU0MjYwMzk5MjM2

Please try to deploy this project on netlify

@PedroLamas I just checked your automatic bump. It also bumped sharp from 0.23.4 to 0.25.1

I remember when looking at this issue before, libvips (the library Sharp uses) changed its API from 8.8 to 8.9

If you can't control your build environment, try downgrading your version of Sharp back to 0.23.4 and use exact versioning when building it.

I found an open issue about it here

Edit:

I found that gatsby-plugin-manifest has a dependency of sharp: 0.25.1 So when you upgraded gatsby-plugin-manifest, it upgraded your version of Sharp causing the incompatibility.

@PedroLamas I just checked your automatic bump. It also bumped sharp from 0.23.4 to 0.25.1

I remember when looking at this issue before, libvips (the library Sharp uses) changed its API from 8.8 to 8.9

If you can't control your build environment, try downgrading your version of Sharp back to 0.23.4 and use exact versioning when building it.

I found an open issue about it here

How to do that ?

@Shashankd48 If you're using yarn, you can set a "resolutions" field in your package.json

Using Resolutions in Yarn

If you're using npm, it gets a little weirder. So your issue is that you updated your gatsby-plugin-sharp So you went from 0.23.4 to 0.25.1

The easiest way for npm would be to run:

npm uninstall gatsby-plugin-sharp
npm install gatsby-plugin-sharp@<version>

Unfortunately, I'm not sure what version of gatsby-plugin-sharp Caused the bump in sharp so I can't give you an exact version number to use.

@Shashankd48 I had some time to look through the source code for gatsby-plugin-sharp

Try running:

npm uninstall gatsby-plugin-sharp
npm install [email protected]

Then see if you're able to deploy to Netlify.

I'm going to say this is an issue with Netlify and the containers they provide you.

There are a few different ways to fix this, I'll list them in the order of what I believe would require the least amount of additional work.

1.) You could try deleting the cache and deploying with a new build of dependencies

Docs on deleting the cache and redeploying

Please note

I have not tested if there are any side effects or if the below recommendations to update the container dependencies will work. It's purely a theory that could possibly fix the issue you're facing.


Documentation on Netlify of Build commands

2.) You could try updating the already installed packages in your Netlify build command.

apt-get update && apt-get upgrade -y


3.) You could manually update the libvips package on Netlify as well as other dependencies. It appears they use Ubuntu-based distros based on my limited knowledge of Netlify.

In your build command you could try adding:

apt update && apt upgrade -y \
apt install gcc g++ make python git libc6-dev build-essential libpng-dev \
libjpeg-dev libvips-dev libvips musl-dev node-gyp pngquant webp \
libgtk2.0-0 libgtk-3-0 libnotify-dev libgconf-2-4 libnss3 libxss1 \
libasound2 libxtst6 xauth xvfb -y

I use these dependencies in my Dockerfile

I'm not sure how many of the above dependencies are necessary. I use it to also test with Cypress so I remember adding additional packages, but it at least gives you something to get the site deployed.

The below option is probably the least optimal because it prevents you from updating your NPM packages in the future

4.) Finally you could go through your package-lock.json And see what's updating sharp and uninstall them and reinstall a previous package which does not update sharp.

At the end of the day, this is an issue with your build provider, whether it be Netlify or anybody else.

Let me know if any of the above helped and then I would like to close this issue as it really isn't an issue with Gatsby itself but rather whoever you're deploying Gatsby with.

Problem solved i had to update some of the packages manually

Solved here too, the automatic PR has now merged!

Problem solved I had to update some of the packages manually

I'm encountering the same problem. Can you tell me which all packages you have updated?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timbrandin picture timbrandin  路  3Comments

mikestopcontinues picture mikestopcontinues  路  3Comments

andykais picture andykais  路  3Comments

magicly picture magicly  路  3Comments

rossPatton picture rossPatton  路  3Comments