【发布时间】:2018-11-11 05:39:56
【问题描述】:
问题的完整描述可以在这里找到https://github.com/gatsbyjs/gatsby/issues/5638
简而言之,我使用gatsby-plugin-remark 和gatsby-transformer-remark 来优化放置在md 文件的frontmatter 中的图像。
假设我的降价文件有
---
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
---
...
我像这样查询它
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 工作得很好。但是当我运行gatsby build 时,它会出错
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
虽然构建实际上工作得很好。
要复制,请分叉此存储库https://github.com/swashata/swas.io 并运行yarn build。错误日志也可以在这里找到https://app.netlify.com/sites/optimistic-perlman-163196/deploys/5b10e5cdb3127429bf8a5d5d
我已经尝试了所有方法来解决这个问题
- 为每一个frontmatter添加featured_image。
- 从 graphql 中删除 features_image 查询。
- 移除 gatsby-remark-images 插件。
但似乎没有任何效果,除了实际删除图像和尖锐插件。
非常感谢您在查找问题方面的任何帮助。
【问题讨论】:
标签: gatsby