2

我最近从 react static 切换到了 gatsby & 撞墙。当我安装和构建 gatsby-starter-netlify-cms 时出现错误:

success open and validate gatsby-configs — 0.049 s
success load plugins — 1.757 s
success onPreInit — 53.736 s
success delete html and css files from previous builds — 0.013 ssuccess initialize cache — 0.725 s
success copy gatsby files — 4.323 s
success onPreBootstrap — 0.261 s
success source and transform nodes — 1.672 s
success building schema — 6.302 s
success createPages — 0.634 s
success createPagesStatefully — 0.525 s
success onPreExtractQueries — 0.211 s
success update schema — 1.565 s
error GraphQL Error Field "image" must not have a selection since type "String" has no subfields.

  file: C:/Users/Jason/Dropbox/Documents/Projects/jamamuuga-s-portfolio-gatsby-netlifycms/src/templates/product-page.js

   1 |
   2 |   query ProductPage($id: String!) {
   3 |     markdownRemark(id: { eq: $id }) {
   4 |       frontmatter {
   5 |         title
>  6 |         image {
     |               ^
   7 |           childImageSharp {
   8 |             fluid(maxWidth: 2048, quality: 100) {
   9 |               ...GatsbyImageSharpFluid
  10 |             }
  11 |           }
  12 |         }
  13 |         heading
  14 |         description
  15 |         intro {
  16 |           blurbs {

  error Command failed with exit code 1.

我分别尝试使用 yarn 和 npm 均无济于事。

4

1 回答 1

0

您应该检查您的降价文件并找到该字段具有空值的文件image,或指向不存在图像的值。markdown 文件的 Frontmatter 是指文件的顶部,它包含文件的一些元数据,并用---. 例如:

---

图片:

//我的评论:后面是一些其他变量的列表,比如标题,标题......

---

于 2019-02-08T15:35:49.903 回答