【问题标题】:Stuck building gatsby-starter-netlify-cms卡在构建 gatsby-starter-netlify-cms
【发布时间】:2019-04-18 02:45:16
【问题描述】:

我最近从 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 均无济于事。

【问题讨论】:

标签: graphql gatsby netlify-cms


【解决方案1】:

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

---

图片:

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

---

【讨论】:

    猜你喜欢
    • 2021-03-08
    • 1970-01-01
    • 2021-08-29
    • 2020-10-23
    • 2021-05-15
    • 2019-08-06
    • 2019-09-29
    • 1970-01-01
    • 2018-09-26
    相关资源
    最近更新 更多