Error: ENOENT: no such file or directory using Gatsby Image API - Netlify failing to build site

I'm getting this error when starting a Netlify build - it works in local development (the Graphql queries return images).

EDIT: Could this have to do with configuring the sharpkeys array? I've tried a few options, but that doesn't seem to work either, though I could be doing this part incorrectly:

            sharpKeys: [
              /image|photo|picture/, // (default)
              'services_detail_image',
              'hero_background_image'
            ]

Any ideas?

4:51:23 PM: File path: /opt/build/repo/src/templates/services-template.js
4:51:23 PM: Url path: /services/plumbing-electrical
4:51:23 PM: Plugin: none
4:51:23 PM: error There was an error in your GraphQL query:
4:51:23 PM: Unexpected error value: "failed to process https://images.prismic.io/practical-renovations/ba0d6637-567f-4d80-8242-5fbac8d9eaa2_post-1-image.jpg?auto=compress,format&rect=0,250,3590,638&w=1440&h=256\nError: ENOENT: no such file or directory, open '/opt/build/repo/.cache/caches/gatsby-source-prismic-graphql/tmp-468f542fe6e3513b3b6aa69426b4458f.jpg'"
4:51:23 PM:   15 |                   base64
4:51:23 PM:   16 |                   tracedSVG
4:51:23 PM:   17 |                   srcWebp
4:51:23 PM:   18 |                   srcSetWebp
4:51:23 PM:   19 |                   originalImg
4:51:23 PM:   20 |                   originalName
4:51:23 PM:   21 |                 }
4:51:23 PM:   22 |               }
4:51:23 PM:   23 |             }
4:51:23 PM:   24 |           }
4:51:23 PM: > 25 |           hero_background_imageSharp {
4:51:23 PM:      |           ^
4:51:23 PM:   26 |             childImageSharp {
4:51:23 PM:   27 |               fluid {
4:51:23 PM:   28 |                 base64
4:51:23 PM:   29 |                 tracedSVG
4:51:23 PM:   30 |                 srcWebp
4:51:23 PM:   31 |                 srcSetWebp
4:51:23 PM:   32 |                 originalImg
4:51:23 PM:   33 |                 originalName
4:51:23 PM:   34 |               }
4:51:23 PM:   35 |             }

Can you clear the build cache? It looks like it’s missing from /opt/build/repo/.cache/caches/, which may be causing an error.

This solution on GitHub took care of it:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.