Javascript 盖茨比内容-GraphQL查询错误:未知类型;“内容固定”;

Javascript 盖茨比内容-GraphQL查询错误:未知类型;“内容固定”;,javascript,node.js,graphql,gatsby,contentful,Javascript,Node.js,Graphql,Gatsby,Contentful,我决定建立自己的博客,并选择埃马苏里亚诺的盖茨比搭档作为我的盖茨比首发(我对盖茨比绝对陌生,而且很满足!) 我按照指示做了一切,设置了我的环境,设置了Contentful空间,并登录到Contentful等等 目前,我使用的是Ubuntu 18.04和 下面的一切都很顺利 $ gatsby new mate-portfolio https://github.com/EmaSuriano/gatsby-starter-mate $ yarn setup 但是当我 $ yarn start

我决定建立自己的博客,并选择埃马苏里亚诺的盖茨比搭档作为我的盖茨比首发(我对盖茨比绝对陌生,而且很满足!)

我按照指示做了一切,设置了我的环境,设置了Contentful空间,并登录到Contentful等等

目前,我使用的是Ubuntu 18.04和


下面的一切都很顺利

$ gatsby new mate-portfolio https://github.com/EmaSuriano/gatsby-starter-mate  
$ yarn setup
但是当我

$ yarn start
然后输入localhost:8000 I get编译失败页面时出现大量错误

我参考了这个问题来解决我的问题,并尝试了解决方案,如

  • 删除fragments.js文件中的代码
  • 删除.cache文件夹
  • 将虚拟图像添加到我的空间
  • 我还安装了
    $npm安装--save gatsby source contentful
    $warn是否添加了gatsby
    以及
    $warn global是否也添加了contentful cli

    但没有一个成功。下面是我在localhost:8000上显示的错误,当我
    $warn start

    有人能帮我解决这个问题吗?非常感谢你

    There was an error in your GraphQL query:
    
    Unknown type "ContentfulFixed".
    
    File: /blog/node_modules/gatsby-source-contentful/src/fragments.js
    
    There was an error in your GraphQL query:
    
    Unknown type "ContentfulFixed".
    
    File: /blog/node_modules/gatsby-source-contentful/src/fragments.js
    
    There was an error in your GraphQL query:
    
    Unknown type "ContentfulFluid".
    
    File: /blog/node_modules/gatsby-source-contentful/src/fragments.js
    
    There was an error in your GraphQL query:
    
    Unknown type "ContentfulFluid".
    
    File: /blog/node_modules/gatsby-source-contentful/src/fragments.js
    
    There was an error in your GraphQL query:
    
    Unknown type "ContentfulResolutions".
    
    File: /blog/node_modules/gatsby-source-contentful/src/fragments.js
    
    There was an error in your GraphQL query:
    
    Unknown type "ContentfulResolutions".
    
    File: /blog/node_modules/gatsby-source-contentful/src/fragments.js
    
    There was an error in your GraphQL query:
    
    Unknown type "ContentfulResolutions".
    
    File: /blog/node_modules/gatsby-source-contentful/src/fragments.js
    
    There was an error in your GraphQL query:
    
    Unknown type "ContentfulSizes".
    
    File: /blog/node_modules/gatsby-source-contentful/src/fragments.js
    
    There was an error in your GraphQL query:
    
    Unknown type "ContentfulSizes".
    
    File: /blog/node_modules/gatsby-source-contentful/src/fragments.js
    
    There was an error in your GraphQL query:
    
    Unknown type "ContentfulSizes".
    
    File: /blog/node_modules/gatsby-source-contentful/src/fragments.js
    
    There was an error in your GraphQL query:
    
    Cannot query field "contentfulAbout" on type "Query".
    
    If you don't expect "contentfulAbout" to exist on the type "Query" it is most likely a typo.
    However, if you expect "contentfulAbout" to exist there are a couple of solutions to common problems:
    
    - If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
    - The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
    - You want to optionally use your field "contentfulAbout" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")
    
    It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "Query":
    https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions
    
    File: /blog/src/components/Helmet.js
    
    There was an error in your GraphQL query:
    
    Cannot query field "contentfulAbout" on type "Query".
    
    If you don't expect "contentfulAbout" to exist on the type "Query" it is most likely a typo.
    However, if you expect "contentfulAbout" to exist there are a couple of solutions to common problems:
    
    - If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
    - The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
    - You want to optionally use your field "contentfulAbout" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")
    
    It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "Query":
    https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions
    
    File: /blog/src/components/Footer.js
    
    There was an error in your GraphQL query:
    
    Cannot query field "contentfulAbout" on type "Query".
    
    If you don't expect "contentfulAbout" to exist on the type "Query" it is most likely a typo.
    However, if you expect "contentfulAbout" to exist there are a couple of solutions to common problems:
    
    - If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
    - The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
    - You want to optionally use your field "contentfulAbout" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")
    
    It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "Query":
    https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions
    
    File: /blog/src/sections/Landing.js
    
    There was an error in your GraphQL query:
    
    Cannot query field "siteMetadata" on type "Site".
    
    If you don't expect "siteMetadata" to exist on the type "Site" it is most likely a typo.
    However, if you expect "siteMetadata" to exist there are a couple of solutions to common problems:
    
    - If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
    - The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
    - You want to optionally use your field "siteMetadata" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")
    
    It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "Site":
    https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions
    
    File: /blog/src/sections/Landing.js
    
    There was an error in your GraphQL query:
    
    Cannot query field "contentfulAbout" on type "Query".
    
    If you don't expect "contentfulAbout" to exist on the type "Query" it is most likely a typo.
    However, if you expect "contentfulAbout" to exist there are a couple of solutions to common problems:
    
    - If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
    - The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
    - You want to optionally use your field "contentfulAbout" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")
    
    It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "Query":
    https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions
    
    File: /blog/src/sections/Projects.js
    
    There was an error in your GraphQL query:
    
    Cannot query field "siteMetadata" on type "Site".
    
    If you don't expect "siteMetadata" to exist on the type "Site" it is most likely a typo.
    However, if you expect "siteMetadata" to exist there are a couple of solutions to common problems:
    
    - If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
    - The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
    - You want to optionally use your field "siteMetadata" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")
    
    It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "Site":
    https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions
    
    File: /blog/src/sections/Writing.js
    
    There was an error in your GraphQL query:
    
    Cannot query field "allMediumPost" on type "Query".
    
    If you don't expect "allMediumPost" to exist on the type "Query" it is most likely a typo.
    However, if you expect "allMediumPost" to exist there are a couple of solutions to common problems:
    
    - If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
    - The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
    - You want to optionally use your field "allMediumPost" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")
    
    It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "Query":
    https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions
    
    File: /blog/src/sections/Writing.js
    
    There was an error in your GraphQL query:
    
    Cannot query field "mediumUser" on type "Query".
    
    If you don't expect "mediumUser" to exist on the type "Query" it is most likely a typo.
    However, if you expect "mediumUser" to exist there are a couple of solutions to common problems:
    
    - If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
    - The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
    - You want to optionally use your field "mediumUser" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")
    
    It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "Query":
    https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions
    
    File: /blog/src/sections/Writing.js
    
    There was an error in your GraphQL query:
    
    Cannot query field "contentfulAbout" on type "Query".
    
    If you don't expect "contentfulAbout" to exist on the type "Query" it is most likely a typo.
    However, if you expect "contentfulAbout" to exist there are a couple of solutions to common problems:
    
    - If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
    - The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
    - You want to optionally use your field "contentfulAbout" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")
    
    It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema for "Query":
    https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions
    
    File: /blog/src/sections/About.js
    

    正如所讨论的,这是一个悬而未决的问题。尝试将任何图像添加和发布到媒体资产可能会解决此问题。也试着跑步

    gatsby clean
    

    在开始纺纱之前

    我是该包装的维护者。我在玩不同版本的依赖项,检查它们是如何协同工作的,我发现破坏盖茨比版本实际上是破坏项目的原因

    请检查您是否正在使用
    包中的
    版本“gatsby”:“2.15.22”
    、json
    纱线.lock
    节点模块


    希望有帮助

    确保contenful中的每种内容类型都有一个条目。包括一项资产。这似乎是许多人的问题。

    更新:我成功地删除了
    未知类型“ContentfulFixed”
    未知类型“ContentfulFluid”
    未知类型“ContentfulResolutions”
    未知类型“ContentfulSizes”的GraphQL查询错误
    通过删除
    ../src/fragments.js
    文件,但查询字段错误仍然存在,例如下面的
    “contentfulAbout”
    “allMediumPost”
    无法解决:'(您是否向Contentful添加了一个中等用户和一个关于文本?此错误由GraphQL触发,因为它试图从Contentful中提取此数据,但找不到它。您的
    文件中是否有有效的
    访问令牌
    空格\u ID
    ?是的,正如@RobinMétral所述,请确保您的所有内容模型都在lea这是该模型的一个内容。
    gatsby clean