盖茨比在Netlify上构建错误:错误多个“根"在文件中找到的查询 [英] Gatsby build error on Netlify: error Multiple "root" queries found in file

查看:45
本文介绍了盖茨比在Netlify上构建错误:错误多个“根"在文件中找到的查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在Netlify上进行构建,但是我在macOS上的终端中成功完成了构建.

I cannot make a build on Netlify but I did it successfully in my terminal on macOS.

根查询"是什么意思?有人遇到同样的问题吗?这是来自netlify的日志:

What does "root queries" mean?, does anyone got same issue ? Here's the log from netlify:

11:10:25 AM: success createPagesStatefully - 0.217s
11:10:25 AM: success onPreExtractQueries - 0.000s
11:10:25 AM: success update schema - 0.065s
11:10:25 AM: error Multiple "root" queries found in file: "headerTitleQuery" and "headerTitleQuery".
11:10:25 AM: Only the first ("headerTitleQuery") will be registered.
11:10:25 AM: Instead of:
11:10:25 AM: 1 | query headerTitleQuery {
11:10:25 AM: 2 |   bar {
11:10:25 AM: 3 |     #...
11:10:25 AM: 4 |   }
11:10:25 AM: 5 | }
11:10:25 AM: 6 |
11:10:25 AM: 7 | query headerTitleQuery {
11:10:25 AM: 8 |   foo {
11:10:25 AM: 9 |     #...
11:10:25 AM: 10 |   }
11:10:25 AM: 11 | }
11:10:25 AM: Do:
11:10:25 AM: 1 | query headerTitleQueryAndHeaderTitleQuery {
11:10:25 AM: 2 |   bar {
11:10:25 AM: 3 |     #...
11:10:25 AM: 4 |   }
11:10:25 AM: 5 |   foo {
11:10:25 AM: 6 |     #...
11:10:25 AM: 7 |   }
11:10:25 AM: 8 | }
11:10:25 AM: failed extract queries from components - 0.496s
11:10:25 AM: Skipping functions preparation step: no functions directory set
11:10:25 AM: Caching artifacts
11:10:26 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
11:10:25 AM: Started saving node modules
11:10:25 AM: Finished saving node modules
11:10:25 AM: Started saving yarn cache
11:10:25 AM: Finished saving yarn cache
11:10:25 AM: Started saving pip cache
11:10:26 AM: Shutting down logging, 12 messages pending
11:10:25 AM: Finished saving pip cache

推荐答案

好的,我解决了.

除了做一些小小的研究外,我还必须记住在此之前我做了什么,结果发现我遇到了一个区分大小写的问题,因此我需要进行一些更改,以使两个文件具有相同的在同一文件夹下的名称.

More than a little research I had to remember what thing I did before that happened, it turns out I had got a case-sensitive issue so I needed to make some changes in such a way that result in two files with the same name under the same folder.

这意味着我确实有两个完全相同的组件(Header.js和header.js)试图在构建过程的中间执行相同的查询headerTitleQuery,所以我删除了header.js,噩梦结束了.

That means I indeed had two identical components (Header.js and header.js) trying to execute the same query headerTitleQuery in middle of the build process, so I deleted header.js and the nightmare is over.

简而言之,要解决该问题,只需确保您只有唯一名称的组件文件,并且在Linux和macOS上工作时都不要忽略区分大小写的文件名.

In short, to get it solved just make sure you have only unique-name component files and don't ignore the case-sensitive filenames when you work on both linux and macOS.

为什么它可以在我的macOS终端上使用?

由于我在macOS上的本地工作区忽略了区分大小写的文件名,因此Netlify(可在linux实例上运行)只是不这样做.

Because my local workspace on macOS is ignoring the case-sensitive filenames, Netlify (which operates over linux instances) just doesn't do that.

这篇关于盖茨比在Netlify上构建错误:错误多个“根"在文件中找到的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆