Docz: Gastby错误:RelayParser-重复的文档:-DefaultSEOQuery

创建于 2019-07-04  ·  10评论  ·  资料来源: doczjs/docz

错误报告

描述错误
盖茨比的身材被打破了。 我遵循https://www.docz.site/docs/gatsby-theme#how -to-use的指示

清楚简明地描述错误是什么。

当我午餐时,我的gatsby develop

重现

  1. 转到https://github.com/sutter/hello-gatsby/tree/feature/add-documentation '
  2. 克隆存储库,阅读自述文件以安装dev devecies
➜  hello-gatsby git:(feature/add-documentation) gatsby develop
Configuring yargs through package.json is deprecated and will be removed in the
success open and validate gatsby-configs - 2.034 s
success load plugins - 0.970 s
Configuring yargs through package.json is deprecated and will be removed in the
success onPreInit - 0.312 s
success initialize cache - 0.006 s
success copy gatsby files - 0.066 s
success onPreBootstrap - 0.009 s
Configuring yargs through package.json is deprecated and will be removed in the
success source and transform nodes - 0.532 s
success building schema - 0.287 s
Configuring yargs through package.json is deprecated and will be removed in the
success createPages - 0.309 s
success createPagesStatefully - 0.036 s
success onPreExtractQueries - 0.002 s
success update schema - 0.041 s

 ERROR 

There was a problem parsing "/Users/laurentsutterlity/Works/hello-gatsby/node_modules/gatsby-theme-docz/templates/Layout.tpl.js"; any GraphQL fragments or queries in this file were not processed.
This may indicate a syntax error in the code, or it may be a file type that Gatsby does not know how to parse.


 ERROR #85901  GRAPHQL

There was an error in your GraphQL query:

Error: RelayParser: Encountered duplicate defintitions for one or more documents: each document must have a unique name. Duplicated documents:
- DefaultSEOQuery

success extract queries from components - 8.357 s
success write out requires - 0.008 s
success write out redirect data - 0.002 s
success Build manifest and related icons - 0.137 s
success onPostBootstrap - 0.144 s
⠀
info bootstrap finished - 17.704 s
⠀
success run static queries - 0.002 s
success run page queries - 0.026 s — 7/7 292.91 queries/second
 DONE  Compiled successfully in 6477ms                                    09:12:11
⠀
You can now view hello-gatsby in the browser.
⠀
  http://localhost:8000/
⠀
View GraphiQL, an in-browser IDE, to explore your site's data and schema
⠀
  http://localhost:8000/___graphql
⠀
Note that the development build is not optimized.
To create a production build, use npm run build

环境

  • 作业系统:[10.14.5]
  • 节点版本:[v10.15.3]
  • 纱线版本:[1.15.2]
bug stale v1

最有用的评论

如果有人使用v2,只需确保您的gatsby是最新的并且应该没问题,现在对于由于任何原因卡在v1上的任何人(例如我),您都可以通过更改docz gatsby中的文件来本地解决问题主题在您的node_modules ,主要缺点是,无论何时添加或更新依赖项,它都会覆盖此修复程序,但是对我来说,替换文件作为构建的一部分使我能够使其完全自动化。

主要问题是文件node_modules/gatsby-theme-docs/templates/Seo.js.tpl它导出查询,并且由于它打算用作生成另一个文件的模板,但仍由gatsby处理,因此最终在模式中重复了其查询名称,即错误。 因此,要解决此问题,只需从查询中删除名称,因为仅在使用变量时在graphql中才需要查询名称,因此此查询不需要名称,因此只需更改该文件中的名称即可。

query DefaultSeoQuery {

进入

query {

所有10条评论

这是与新版盖茨比有关的错误,我认为他们正在努力解决此问题。
cc @pieh

类似的问题在这里

同样也遇到了同样的问题,您是否知道Gatsby的先前版本是否仍然可以使用,或者甚至考虑使用较旧的版本是否会造成依赖混乱?

安装Docz主题后出现类似问题。

编辑:实际上,我有完全相同的问题。
有什么解决方法吗?

安装Docz Theme之后,此处相同。

编辑:我们有关于这个问题的消息吗?

在尝试迁移到v2之后,我也遇到了这个问题。 如果它与Gatsby相关,为什么还要带有v1标签?

面对v2.0.0-rc.31 😬的问题

如果有人使用v2,只需确保您的gatsby是最新的并且应该没问题,现在对于由于任何原因卡在v1上的任何人(例如我),您都可以通过更改docz gatsby中的文件来本地解决问题主题在您的node_modules ,主要缺点是,无论何时添加或更新依赖项,它都会覆盖此修复程序,但是对我来说,替换文件作为构建的一部分使我能够使其完全自动化。

主要问题是文件node_modules/gatsby-theme-docs/templates/Seo.js.tpl它导出查询,并且由于它打算用作生成另一个文件的模板,但仍由gatsby处理,因此最终在模式中重复了其查询名称,即错误。 因此,要解决此问题,只需从查询中删除名称,因为仅在使用变量时在graphql中才需要查询名称,因此此查询不需要名称,因此只需更改该文件中的名称即可。

query DefaultSeoQuery {

进入

query {

感谢@jstacoder提供解决方案👍!

如果在构建步骤中使用@jstacoder的解决方案来不断更改node_modules ,请确保签出patch-package

由于此问题最近没有活动,因此已被自动标记为陈旧。 如果没有进一步的活动,它将关闭。 感谢您的贡献。

此页面是否有帮助?
0 / 5 - 0 等级