Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#39514·gatsby

Installation of "sharp" npm package fails with NodeJS v22.

Author: Taras-DydaCreated Mar 24, 2026Updated Jun 10, 2026
Labelstype: bugstatus: triage needed

Preliminary Checks

  • This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
  • This issue is not a question, feature request, RFC, or anything other than a bug report directly related to Gatsby. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions

Description

We use the "gatsby-plugin-sharp" and "gatsby-transformer-sharp" npm packages in our project. The issue is that, during the production build, when yarn installs modules, it sometimes throws errors while installing the sharp package. This issue occurs rarely. When the installation process fails, we encounter one of the following errors:

  1. Timeout error:
  1. fatal error: glib-object.h: No such file or directory

This error started happening after upgrading Node.js from version 20 to version 22. These errors occur only during the production build when installing node modules (on Netlify in our case). I do not encounter this issue locally.

Reproduction Link

https://www.gatsbyjs.com/

Steps to Reproduce

  1. Install NodeJS v22
  2. Add gatsby-plugin-sharp and gatsby-transformer-sharp dependencies to your project
  3. Remove node_modules folder
  4. Install node modules (An error should appear at this step.)
  5. This error occurs rarely, so it might be difficult to reproduce it.

Expected Result

Installation of npm packages should complete successfully as part of the production build.

Actual Result

The installation of npm packages sometimes fails during the production build, with the errors described in the description section.

Environment

System:
    OS: macOS 15.7.4
    CPU: (12) arm64 Apple M3 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.22.0 - ~/.nvm/versions/node/v22.22.0/bin/node
    Yarn: 4.10.3 - ~/.nvm/versions/node/v22.22.0/bin/yarn
    npm: 10.9.4 - ~/.nvm/versions/node/v22.22.0/bin/npm
  Browsers:
    Safari: 18.6

Config Flags

No response

Source: gatsbyjs/gatsby

View original on GitHubView discussion on GitHub