gatsby: [bug]: sharp and image processing failures
Description
In this issue, I’d like to collect any issues others have run into regarding image processing failures with Gatsby. These should be focused on build failures and not warnings. For instance–if a failure occurred installing Sharp, note what the error message was and any additional environment details that would be helpful for debugging the issue. Typically, these will be things like Node version, version of gatsby, version of sharp, etc. (gatsby info --clipboard
will be very helpful here) and consider following the template below to craft your reply.
Also note: this is not only for issues that you don’t have a solution for. If you had an issue with image processing + Gatsby and were able to solve it, please 1) edit/update your reply, or 2) provide a comment with the fix.
But… why?
If we can track on the most common issues people are encountering, we can make upstream improvements to our dependencies and also update our documentation to avoid issues in the future, where appropriate. Win/win!
Template
Please use the below template to add your issue, if at all possible!
## High-level error message or summary
> Paste the actual one or two line error
### Solution
<!-- If applicable -->
### Stacktrace
<!-- Full stacktrace, if applicable -->
### Environment info
<!-- Please paste the result of `npx gatsby clipboard --info` or `gatsby clipboard --info` if globally installed -->
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 23 (6 by maintainers)
I’ve got a set of images linked from mdx files that are consistently skipped during
gatsby build
process. This can be observed in this branch.The result occurs both locally and when deployed. Click here for the netlify preview built
Also worth noting that the images are repeated in two
images
subfolders under/content/blog
and fail to process in both.The images appear as expected in development with
gatsby develop
No errors, traces, warnings, or other indications of failure occur.
Unable to build Sharp
Can’t run a fresh
yarn install
.Reproducing
Run
gatsby new
, remove all but the below inpackage.json
, deletenode_modules
and runyarn install
.If I remove
styled-components
it works great, but I think there are more plugins that can be the third plugin in the dependencies list above and still reproduce the same error.Solution
Currently, I need to remove the
gatsby-plugin-manifest
, runyarn install
and then add it withyarn add gatsby-plugin-manifest
.Stacktrace
Environment info
I have installed
node
as a snap package:@arturhenryy Hey artur, thanks for your response, this was indeed related to having no swapspace available, I followed the instructions in the stackoverflow link you provided and it build successfully, Thanks a lot!
@Saint2Laurent this error occurs when your server has no or not enough swapspace available. check this thread. not really related to the original question here https://stackoverflow.com/questions/26193654/node-js-catch-enomem-error-thrown-after-spawn
Error: VipsImage: unable to write to
Attempting to build the example using-gatsby-image fails, no changes made.
libvips should be installed fine afaik as it’s worked on other projects with the Docker image I’ve been using. I am copying over my own binaries/versions for libvips(8.7.0), and imagemin mozjpeg,cwebp-bin,pngquant-bin for musl compatible versions.
Stacktrace
I can confirm that libvips has written jpg images to /tmp successfully, just not this .v file.
The later lines about GLib I’m not sure if they’re actually related from what I’ve read about the error, though this is Alpine which uses musl instead of libc, but I am using the correct version, pulling the following:
Solution
Turns out to be a problem with running libvips on Alpine and writing to /tmp. There is an expected fix with upcoming 8.7.1.
Environment info
gatsby info
seems to just hang, I assume it’s trying to do something that isn’t supported on Alpine or that I’m missing a package for.gatsby -v
outputs v2.4.8.package.json:
Related issues at https://github.com/gatsbyjs/gatsby/issues/8301 and https://github.com/gatsbyjs/gatsby/issues/10620
i would like to reference this issue here #10347 localfile creation for images are silently failing. it is already recognized as a bug but it seems that it has been forgotten about, although this is a pretty critical bug imo.