GatsbyJS: Something went wrong installing the "sharp" module (fix)

If you get the following or a similar sharp module related error when trying to launch your local Gatsby server:

Something went wrong installing the "sharp" module

The module '/node_modules/sharp/build/Release/sharp.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 83. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).

- Ensure the version of Node.js used at install time matches that used at runtime
- Consult the installation documentation at
- Search for this error at

There could be many reasons you get this error, as you’ll find out when searching on GitHub and StackOverflow. I’ve tried every solution I could find on Google, but nothing has worked so far.

The fix: downgrade Node.js

When I downgrade my Node.js version to an earlier version, the problem went away instantly.

I was using Node version v14.14.0 when I got the sharp module error and downgraded to several earlier versions without luck. Then I downgraded all the way down to v12.15.0 and this fixed the problem.

Obviously, this is only a short-term fix, since you generally don’t want your projects to run old versions of Node.

You also don’t want to downgrade Node.js on all your projects just because one project (in this case Gatsby) doesn’t work. Therefore I recommend that you use NVM so that you can run multiple versions of Node on your machine without causing problems.

Here’s a tutorial about how to use NVM to run multiple Node.js versions at once

Good to know: if you decide to install another version of Node using NVM, to run your Gatsby project, then you probably have to delete your node_modules directory and run yarn or npm install before trying to run your local Gatsby server again with the downgraded Node.js version.

Also, v12.15.0 happened to fix the sharp module error on my end, but you might need a different version on your end.

Has this been helpful to you?

You can support my work by sharing this article with others, or perhaps buy me a cup of coffee 😊


Share & Discuss on