Gatsby Contentful-GraphQL查询错误:未知类型“ ContentfulFixed”

问题描述 投票:1回答:1

我已经决定建立自己的博客,并选择EmaSuriano的gatsby-starter-mate作为我的Gatsby Starter (我绝对对Gatsby还是陌生的!)>] >>

我按照说明进行了所有操作,设置了我的环境,设置了Contentful空间并登录到Contentful等。

目前,我在Ubuntu 18.04

$ gatsby --version
Gatsby CLI version: 2.10.10
Gatsby version: 2.19.45

$ contentful --version
1.2.14

以下所有内容均无问题

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

但是当我

$ yarn start

然后输入localhost:8000

,我得到Failed to Compile
页面,其中包含大量错误。

我参考此https://github.com/gatsbyjs/gatsby/issues/16455问题来解决我的问题,并尝试了可用的解决方案,例如

  1. 删除fragments.js文件中的代码
  2. 删除.cache文件夹
  3. 向我的空间添加虚拟图像
  4. 我还安装了$ npm install --save gatsby-source-contentful$ yarn add gatsby$ yarn global add contentful-cli也一样。

但是他们都没有工作。以下是我$ yarn start时在localhost:8000

上显示的错误。谁能帮我解决这个问题?非常感谢!
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

我已经决定建立自己的博客,并选择EmaSuriano的gatsby-starter-mate作为我的Gatsby Starter(我绝对是Gatsby和Contentful的新手!)我按照说明做了一切,设置了环境,...]

这是一个未解决的问题,如here所述。尝试将任何图像添加和发布到媒体资产可能会解决该问题。也可以尝试运行

gatsby clean

开始运行纱线之前

javascript node.js graphql gatsby contentful
1个回答
0
投票

这是一个未解决的问题,如here所述。尝试将任何图像添加和发布到媒体资产可能会解决该问题。也可以尝试运行

© www.soinside.com 2019 - 2024. All rights reserved.