DGB
DGB

Reputation: 1342

Gatsby project giving strange errors and is unable to build

I npm install --save gatsby-transformer-sharp gatsby-plugin-sharp and then after doing so I'm unable to run my project and I'm getting these strange errors:

(sharp:7804): GLib-GObject-WARNING **: 14:10:08.042: cannot register existing type 'VipsObject'

(sharp:7804): GLib-CRITICAL **: 14:10:08.043: g_once_init_leave: assertion 'result != 0' failed

(sharp:7804): GLib-GObject-CRITICAL **: 14:10:08.043: g_type_register_static: assertion 'parent_type > 0' failed

(sharp:7804): GLib-CRITICAL **: 14:10:08.043: g_once_init_leave: assertion 'result != 0' failed

Upvotes: 9

Views: 970

Answers (3)

gvdp
gvdp

Reputation: 86

I was experiencing the same issue (working with Yarn, not npm). It seems the wrong version of some binary was cached somewhere.

What fixed the issue for me was running yarn cache clean, removing the entire node_modules and installing all dependencies again.

Upvotes: 2

EliteRaceElephant
EliteRaceElephant

Reputation: 8162

The problem is most likely the npm ecosystem with breaking changes within versions. There are two possible solutions:

1. Rebuild and switch dependency manager

Switching from npm to yarn might just solve it. If you search github issues you will find a lot of package manager related issues with npm. I can speak from my own experience that the simple switch worked in my case. yarn for whatever reason works more reliable. The gatsby maintainers recommend yarn for Gatsby development.

2. Remove faulty plugins

The thousands of packages depending on each other regularly introduce regression errors for each other. Removing dependencies one by one, gatsby clean + yarn, might be able to solve it. As @Zecide mentioned, start with gatsby-plugin-favicon if you use that.

Upvotes: 0

Sid Ali
Sid Ali

Reputation: 1857

The error is caused by : gatsby-plugin-favicon , sharp was not updated on it, for now just uninstall it.

Upvotes: 4

Related Questions