gatsby: GLib-GObject-CRITICAL error with last gatsby-transformer-sharp
Description
Hey all,
Since I updated all of my packages I have been unable to run gatsby develop nor gatsby build.
The builder is able run all of my static and page queries and then fails once it reaches the start webpack server process.
I have tried reinstalling all of my node modules, updating glib through brew, I’ve also tried to run on several different environments.
(Other OSX computers are getting the same error for me, whilst my Ubuntu machine can run develop and build fine)
Actual result
Once gatsby develop gets to start webpack server it throws the following as errors and then the develop process stops.
(sharp:65167): GLib-GObject-WARNING **: 16:35:38.095: cannot register existing type 'VipsObject'
(sharp:65167): GLib-CRITICAL **: 16:35:38.095: g_once_init_leave: assertion 'result != 0' failed
(sharp:65167): GLib-GObject-CRITICAL **: 16:35:38.095: g_type_register_static: assertion 'parent_type > 0' failed
(sharp:65167): GLib-CRITICAL **: 16:35:38.095: g_once_init_leave: assertion 'result != 0' failed
Environment
System: OS: macOS 10.14.6 CPU: (12) x64 Intel® Core™ i7-8700B CPU @ 3.20GHz Shell: 5.3 - /bin/zsh Binaries: Node: 10.16.3 - /usr/local/bin/node Yarn: 1.17.3 - /usr/local/bin/yarn npm: 6.9.0 - /usr/local/bin/npm Languages: Python: 2.7.16 - /usr/local/bin/python Browsers: Chrome: 76.0.3809.100 Safari: 12.1.2 npmPackages: gatsby: ^2.13.72 => 2.13.75 gatsby-background-image: ^0.8.5 => 0.8.5 gatsby-graphiql-explorer: ^0.2.4 => 0.2.6 gatsby-image: ^2.2.10 => 2.2.11 gatsby-plugin-catch-links: ^2.1.4 => 2.1.4 gatsby-plugin-favicon: ^3.1.6 => 3.1.6 gatsby-plugin-feed: ^2.3.7 => 2.3.7 gatsby-plugin-google-analytics: ^2.1.8 => 2.1.8 gatsby-plugin-humans-txt: ^1.1.3 => 1.1.3 gatsby-plugin-manifest: ^2.2.6 => 2.2.8 gatsby-plugin-no-sourcemaps: ^2.1.1 => 2.1.1 gatsby-plugin-offline: ^2.2.7 => 2.2.9 gatsby-plugin-page-transitions: ^1.0.8 => 1.0.8 gatsby-plugin-react-helmet: ^3.1.4 => 3.1.4 gatsby-plugin-s3: ^0.3.2 => 0.3.2 gatsby-plugin-sass: ^2.1.10 => 2.1.11 gatsby-plugin-sharp: ^2.2.15 => 2.2.15 gatsby-plugin-styled-components: ^3.1.2 => 3.1.2 gatsby-plugin-transition-link: ^1.12.4 => 1.12.4 gatsby-remark-copy-linked-files: ^2.1.7 => 2.1.9 gatsby-remark-images: ^3.1.13 => 3.1.15 gatsby-remark-prismjs: ^3.3.6 => 3.3.7 gatsby-remark-responsive-iframe: ^2.2.5 => 2.2.7 gatsby-remark-smartypants: ^2.1.3 => 2.1.4 gatsby-source-filesystem: ^2.1.10 => 2.1.13 gatsby-source-instagram: ^0.5.1 => 0.5.1 gatsby-transformer-remark: ^2.6.15 => 2.6.17 gatsby-transformer-sharp: ^2.2.7 => 2.2.9 npmGlobalPackages: gatsby-cli: 2.7.36 gatsby: 2.13.75
Any help would be fantastic
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 16
- Comments: 47 (24 by maintainers)
Commits related to this issue
- Revert "Update dependencies" This reverts commit 4db084a4ec3c0b3dd5bce87fcc977081d183cffa. — committed to TryGhost/gatsby-starter-ghost by aileen 5 years ago
- ⬇️ Downgrade sharp@0.22.1 for manifest plugin Related issue: https://github.com/gatsbyjs/gatsby/issues/16957 — committed to TryGhost/gatsby-starter-ghost by aileen 5 years ago
- feat(pwa): now with PWA and hack for sharp@0.22.1 issue caused by https://github.com/gatsbyjs/gatsby/issues/16957 — committed to b-n/nom-nom by b-n 5 years ago
- Upgrade npm packages via npm audit Had to set "gatsby-plugin-sharp" to "2.2.12". GitHub issue: https://github.com/gatsbyjs/gatsby/issues/16957 — committed to binerys/me by binerys 5 years ago
- Merge pull request #1 from binerys/package-updates Upgrade npm packages via npm audit Had to set "gatsby-plugin-sharp" to "2.2.12". GitHub issue: gatsbyjs/gatsby#16957 — committed to binerys/me by binerys 5 years ago
- Downgrade sharp to fix rendering https://github.com/gatsbyjs/gatsby/issues/16957 — committed to georgdonner/falter by georgdonner 5 years ago
- Downgraded gatsby-plugin-sharp to 2.2.12 Required to work locally, see https://github.com/gatsbyjs/gatsby/issues/16957#issuecomment-524030831 — committed to spark-solutions/spree by damianlegawiec 5 years ago
- ⬇️ Downgrade sharp@0.22.1 for manifest plugin Related issue: https://github.com/gatsbyjs/gatsby/issues/16957 — committed to aaromp/aaronward.info by aileen 5 years ago
I dig a bit more and it looks to start crashing starting from
gatsby-plugin-sharp@2.2.15so temporary downgrading togatsby-plugin-sharp@2.2.14will do a trick.It looks to be caused by upgrading
sharpfrom^0.22.1to^0.23.0I event don’t know who to @ mention here as this PR was created by @renovate-bot and merged by @gatsbybot 😄
I just tried this and am still having the same error:
@hhimanshu @klgh
You both look to not downgrade actually, the version range you specify
"gatsby-plugin-sharp": "^2.2.12"includes2.2.16. You can even see that in npmPackages output:gatsby-plugin-sharp: ^2.2.12 => 2.2.16- notice, that2.2.16is actually used.Try pinpointing it directly to
"2.2.12".Also, you may try removing
yarn.lockornpm-lock.jsonandnode_modulesand install deps again.Downgrading to
gatsby-plugin-sharp@2.2.14fixes the issue.I just had this problem after upgrading an old project (a few months old). What seems to have worked around it for me was switching to Yarn, with the resolutions config above (https://github.com/gatsbyjs/gatsby/issues/16957#issuecomment-526824124) and then:
For me the issue was
gatsby-plugin-favicondepending on a different version ofsharp:Removing that plugin solved my issue with this…
@LekoArts Should this really be closed? Seems like this is an ongoing issue.
Thanks @sidharthachatterjee! Appending
to
package.jsonand reinstallingnode_modulesworked as a temporary fix.May I suggest that this issue be reopened as long as people are still running into it?
@RomanHotsiy Thanks for investigating! Let’s wait on @lovell (Sharp maintainer) to see if this is a known issue before we merge in https://github.com/gatsbyjs/gatsby/pull/16971
In the mean time, sorry for the trouble, folks! Please use
gatsby-plugin-sharp@2.2.14or set the following in yourpackage.json(when using yarn)I spent 2 days on this issue and here’s how I finally found salvation
$ npm i node@10.15.3 -gThen I had GLib GObject-CRITICAL errors and I checked for different versions of sharp using
$ npm upand
$ npm ls sharpIn the end I believe from my google searching that the issue resides with different versions of sharp
I looked at the gatsby-transformer-sharp and it’s version was off so I saw in the repo that it has the correct version of sharp but my gatsby-transformer-sharp was an older version. I upgraded to
$ npm i gatsby-transformer-sharp@2.3.2$ gatsby developand life was great again. Hope this helps other Gatsby JS shipmates to avoid code sea sickness. Ahoy!I’m not really sure we’ve found the real cause of this issue, https://github.com/gatsbyjs/gatsby/issues/16957#issuecomment-526824124 worked for us but we’re now stuck with sharp 0.22.1 (and warnings).
None of the above suggestions (
npm rebuildmainly) worked on our end.Hi guys,
I’m afraid that I’m still experiencing this issue.
I’ve tried the latest version of the libraries in question, as well as a number of permutations in between. I’ve also tried clearing node_modules and npm rebuild, but still can’t get past this one.
It doesn’t look like there are any conflicting versions of sharp in the tree, see below.
Any ideas on where to go next?
Could people try running
npm rebuild?@dcsan I would call that a workaround rather than a solution since people will keep running into this problem if it requires manual work to avoid. Also, what would be the
yarnequivalent to this? I triedyarn upgradebut that didn’t work for me, resulting in continued version mismatch:I documented a fix for this on some other ticket. basically it’s caused by two mismatching versions of ‘sharp’ which are deps of other packages.
fixed it for me at least
I had the same issue on Netlify but got it working by:
gatsby-plugin-sharp@2.2.14)rm package-lock.jsonrm yarn.lockthen push your changes. if the build fails again then in netlify you will have to click on the failed build click on
retry deploythenClear cache and deploy siteI can confirm that rolling all dependencies that make sure of Sharp to ones that use 0.21.1 avoids the issue, but clearly, this is not a long term solution.
well that’s unfortunate that favicons still seems stuck on an old sharp. perhaps it’s down to the semver upgrade funnily enough I have favicons working in my project, but without that dependency.
As far as I can tell it’s a very deep problem to have two versions of sharp co-existing. We’re dependent on the packages updating to use the same sub-deps of sharp.
also FWIW I stopped using yarn because of various problems with C extensions and native compiling. npm also has a cache now so i think the speed difference isn’t so noticeable.
I just installed latest favicons and indeed get that same problem.
my app will still start but I guess it’s because of the image cache or sharp not getting triggered.
however still starts… so it’s hard to even know how to trigger this nasty problem. probably running the whole install process again.
from my side I just removed the favicons package for now, as I seem to have favicons anyway.
solution here: https://github.com/gatsbyjs/gatsby/issues/9751#issuecomment-533702498
check you don’t have any version mismatches with sharp.
I’m getting identical problems here with latest versions of related plugins
Whats your installed
libvipsversion? And please try runningnpm rebuild, your issues occur most likely due to the fact that your newly installed binary doesn’t work with the installed libvips version on your machine. There should be no need to downgrade the version of gatsby plugins 😃I have this same issue and none of these suggestions has worked for me…I see reference to gatsby-plugin-sharp but we are not using this plugin anywhere. however I have added this and still yet not working… Could someone please help:
success run static queries - 0.098 s — 6/6 84.00 queries/second success run page queries - 1.525 s — 70/70 46.86 queries/second ⠙ start webpack server
(sharp:19129): GLib-GObject-WARNING **: 13:45:01.948: cannot register existing type ‘VipsObject’
(sharp:19129): GLib-CRITICAL **: 13:45:01.948: g_once_init_leave: assertion ‘result != 0’ failed
(sharp:19129): GLib-GObject-CRITICAL **: 13:45:01.948: g_type_register_static: assertion ‘parent_type > 0’ failed
(sharp:19129): GLib-CRITICAL **: 13:45:01.948: g_once_init_leave: assertion ‘result != 0’ failed
This is looking resolved with the latest release for gatsby and version 2.2.16. Thanks all, and happy to close this 😃
@sidharthachatterjee I think the problem is that sharp was cached and when using
npm installit internally usesnpm buildand the postinstall scripts will use the npm cached values,npm rebuildwill not use the cached valuesYou’re right though about CircleCI, I’m not sure why I had problems there
Try adding these at the top of your
gatsby-nodes.js:See https://github.com/gatsbyjs/gatsby/issues/6291#issuecomment-509783902