这是一个未解决的问题,如here所述。尝试将任何图像添加和发布到媒体资产可能会解决该问题。也可以尝试运行
Gatsby Contentful-GraphQL查询错误:未知类型“ ContentfulFixed”
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Gatsby Contentful-GraphQL查询错误:未知类型“ ContentfulFixed”相关的知识,希望对你有一定的参考价值。
我已经决定建立自己的博客,并选择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问题来解决我的问题,并尝试了可用的解决方案,例如
上显示的错误。谁能帮我解决这个问题?非常感谢!
- 删除fragments.js文件中的代码
- 删除.cache文件夹
- 向我的空间添加虚拟图像
我还安装了
$ 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的新手!)我按照说明做了一切,设置了环境,...]
gatsby clean
开始运行纱线之前
这是一个未解决的问题,如here所述。尝试将任何图像添加和发布到媒体资产可能会解决该问题。也可以尝试运行
以上是关于Gatsby Contentful-GraphQL查询错误:未知类型“ ContentfulFixed”的主要内容,如果未能解决你的问题,请参考以下文章
MDX 中的 Gatsby 静态图像(gatsby-plugin-image)
gatsby-image-plugin,StaticImage 不能覆盖默认的包装样式(gatsby-image-wrapper & gatsby-image-wrapper-constrai
Gatsby - webpack 无法使用 `gatsby-plugin-alias-imports` 解析别名导入
带有 gatsby 图像的 Airtable gatsby 源插件
在 Gatsby V4 中使用 Gatsby Source Contentful 找不到缓存文件
Gatsby - 错误:找不到模块 '..\node_modules\gatsby\dist\utils\babel-loader.js'