The full description of the issue can be found here https://github.com/gatsbyjs/gatsby/issues/5638
In short, I am using gatsby-plugin-remark
and gatsby-transformer-remark
to optimize images placed within frontmatter of md files.
Say my markdown file has
---
title: Beautiful UI
featured_image: ../../images/project-vscbui.png
subtitle: A set of color themes for VSCode
order: 90
link: https://vscbui.rocks
templateKey: projects
---
...
And I query it like
export const projectQuery = graphql`
query ProjectQuery {
projects: allMarkdownRemark(
sort: { order: DESC, fields: [frontmatter___order] }
filter: { frontmatter: { templateKey: { eq: "projects" } } }
limit: 1000
) {
edges {
node {
id
frontmatter {
title
subtitle
featured_image {
childImageSharp {
sizes(maxWidth: 960) {
...GatsbyImageSharpSizes
}
}
}
link
}
html
}
}
}
site {
siteMetadata {
shortTitle
}
}
}
`;
gatsby develop
works just fine. But when I run gatsby build
, it fails giving errors
success Building static HTML for pages — 3.818 s
error Input file is missing or of an unsupported image format
Error: Input file is missing or of an unsupported image format
error UNHANDLED REJECTION
Error: Input file is missing or of an unsupported image format
Although the build actually works just fine.
To reproduce, please fork this repository https://github.com/swashata/swas.io and run yarn build
. An error log can also be found here https://app.netlify.com/sites/optimistic-perlman-163196/deploys/5b10e5cdb3127429bf8a5d5d
I have tried all approach for solving this
But nothing seems to work, except for actually removing the images and the sharp plugin.
Any help in finding the issue is very appreciated.
It turns out I actually had a missing image file.
I am using gatsby-plugin-manifest
and the image path I have put there is src/img/ninja.png, but it should have been src/images/ninja.png
. I changed the directory name before and totally forgot to refactor it for the config file. I have corrected and it is working just fine.
So the bottom line is, when this error is happening
gatsby-config.js
file.The debugging path I took was to disable images one by one within the markdown files. But since it didn't solve the problem, I started looking elsewhere and then the gatsby-config.js
came into notice. Totally my fault.
For me I had the correct image and this issue was resolved by:
rm -rf node_modules
rm package-lock.json
npm cache clear --force
npm install
source: https://github.com/gatsbyjs/gatsby/issues/21515#issuecomment-588416624
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With