【发布时间】:2021-10-23 23:35:31
【问题描述】:
在 netlify 上部署时出现错误:
10:49:33 AM:错误您的 GraphQL 查询出现错误:10:49:33 AM:字段“cover”不能有选择,因为类型“String”没有 子字段。上午 10 点 49 分 33 秒:这可能会发生,例如不小心添加了 { } 到“封面”字段。如果你没想到“封面”是类型 “字符串”确保您的输入源和/或插件是正确的。 从组件中提取查询失败 - 0.355 秒
这是我的以下代码:
export const pageQuery = graphql`
{
hero: allMarkdownRemark(filter: { fileAbsolutePath: { regex: "/hero/" } }) {
edges {
node {
frontmatter {
title
name
subtitle
buttonText
}
html
}
}
}
about: allMarkdownRemark(filter: { fileAbsolutePath: { regex: "/about/" } }) {
edges {
node {
frontmatter {
title
avatar {
childImageSharp {
fluid(maxWidth: 700, quality: 90, traceSVG: { color: "#64ffda" }) {
...GatsbyImageSharpFluid_withWebp_tracedSVG
base64
}
}
}
skills
}
html
}
}
}
jobs: allMarkdownRemark(
filter: { fileAbsolutePath: { regex: "/jobs/" } }
sort: { fields: [frontmatter___date], order: DESC }
) {
edges {
node {
frontmatter {
title
company
location
range
url
}
html
}
}
}
featured: allMarkdownRemark(
filter: { fileAbsolutePath: { regex: "/featured/" } }
sort: { fields: [frontmatter___date], order: DESC }
) {
edges {
node {
frontmatter {
title
cover {
childImageSharp {
fluid(maxWidth: 700, quality: 90, traceSVG: { color: "#64ffda" }) {
...GatsbyImageSharpFluid_withWebp_tracedSVG
base64
}
}
}
tech
github
external
}
html
}
}
}
projects: allMarkdownRemark(
filter: {
fileAbsolutePath: { regex: "/projects/" }
frontmatter: { showInProjects: { ne: false } }
}
sort: { fields: [frontmatter___date], order: DESC }
) {
edges {
node {
frontmatter {
title
tech
github
external
}
html
}
}
}
contact: allMarkdownRemark(filter: { fileAbsolutePath: { regex: "/contact/" } }) {
edges {
node {
frontmatter {
title
buttonText
}
html
}
}
}
}
`;
我尝试像人们在尝试搜索解决方案时所说的那样添加 base64,但它仍然给我这个错误。我该如何解决?
【问题讨论】:
-
是否在本地构建?
标签: graphql gatsby gatsby-plugin