Closed martinhj closed 3 years ago
We've bumped a version of sharp recently and this is likely the cause of the problem (other report, probably with a different cause: #28203).
I have several ideas about it. One possible reason is that you have multiple conflicting versions of sharp
. See the log:
10:45:28 AM: > sharp@0.27.0 install /opt/build/repo/node_modules/gatsby-transformer-sharp/node_modules/sharp
10:45:28 AM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
10:45:29 AM: info sharp Using cached /opt/buildhome/.npm/_libvips/libvips-8.10.5-linux-x64.tar.br
10:45:31 AM: > sharp@0.25.4 install /opt/build/repo/node_modules/sharp
10:45:31 AM: > (node install/libvips && node install/dll-copy && prebuild-install --runtime=napi) || (node-gyp rebuild && node install/dll-copy)
It installs both sharp@0.27.0
and sharp@0.25.4
. Try running yarn why sharp
to figure out what packages have older sharp in their deps and try upgrading those. Or put sharp: 0.27.0
in yarn.resolutions
Also, previously we've seen cases when globally installed version of libvips was conflicting with local sharp. So another thing to try:
rm -rf node_modules &&
SHARP_IGNORE_GLOBAL_LIBVIPS=true yarn
Yes, got different versions here:
❯ npm list sharp
cisco--project-workplace-2020@0.1.0 /Users/martinhj/projects/cisco--project-workplace-2020
├─┬ gatsby-plugin-manifest@2.4.28
│ └── sharp@0.25.4
├─┬ gatsby-plugin-sharp@2.12.1
│ └── sharp@0.27.0
└─┬ gatsby-transformer-sharp@2.10.1
└── sharp@0.27.0
Going to upgrade plugin-manifest and build a test on netlify.
Upgrading gatsby-plugin-mainfest
together with gatsby-plugin-sharp
and gatsby-gransformer-sharp
solves the problem. The build now completes successfully also on netlify
We're marking this issue as answered and closing it for now but please feel free to continue this discussion. We hope we managed to help and thank you for using Gatsby! 💜
Description
We got a medium sized gatsby site where we have tried to upgrade gatsby to get the benefits of the DEV_SSR-functionality. In the same progress we upgraded several gatsby* -packages and related dependencies. At first it seemed to work fine, but we have ran into some issues and need to roll back for now. But in the process I want to document our issues as best as possible. I guess issues related to our upgrade attempt, using this for a medium sized web site, would be interesting feedback now gatsby seem to be in a feature transition process .
The issue is that
npm run build
fails on netlify which I guess is related to us bumping gatsby-transformer-sharp and gatsby-plugin-sharp.Steps to reproduce
It would be hard to reproduce this as the project repo is private but content and media is hosted on Contentful. The current theory is that this error happens while processing some invalid / large image. If we are able to isolate where it fails we can provide more information.
It also happens after clearing build cache and setting
PARALLEL_SOURCING: false
. The problem does not happen when build locally. Also tested on netlify with node version v14.15.4 with corresponding npm version.After downgrading plugin-sharp and transformer-sharp to versions used prior to upgrade this issue was resolved (with newer version of gatsby .
Actual result
The whole netlify build output is attached further down, but the central error output is this:
Environment (local - npmPackages should be identical)
Working with following versions after downgrade:
Netlify build output
edit: related?: https://stackoverflow.com/questions/65012190/gatsby-failed-build-on-netlify