Closed dan-mba closed 4 years ago
Probably related: https://github.com/gatsbyjs/gatsby/pull/19665
Sorry, but I can't reproduce this with 2.18.5 :(
Could you try cleaning .cache, public and node_modules and trying again?
OK, things just got weird.
I did everything you said on my Windows 8 development system. I deleted node_modules and re-ran npm install. I ran gatsby clean. The build still fails.
I pushed my updated package.json to my github repo so I could see if my repo failed for you as well. This caused Netlify to rebuild my site. The Netlify build is run on Linux & it completed successfully.
So now I need help determining what external tools the "extract queries from components" step uses. Does this step use any of the node-gyp binaries? I had to set this up for this project & have no idea if my setup is correct.
I am having the same issues
Can you please provide a minimum reproduction? That would help a lot!
@vladar I have no experience with gatsby, so I have no clue how to isolate the problem.
This is my first gatsby project, and the only thing I have changed from the starter is package.json by running npm update.
Is there a verbose option for the build process to get more information?
@andrejarboe Are you on Windows as well?
@dan-mba I suspect it may have something to do with your CMD on windows. When you run npm run build
command - does it show c:\some\path
or C:\some\path
(note the capital drive letter)?
And maybe try switching to the opposite version before running npm run build
just to confirm.
I had the same problem as outlined by several users above The hint above, related to CMD made me try to use git-bash instead of my Windows terminal, and that solved the problem. If I, from a windows terminal, clone, my project, npm install, npm upgrade and Gatsby build, then I get the "Multiple 'root' queries ...' error If I do exactly the same, via git bash, everything is fine :-)
@vladar You have isolated the problem
netlify-blog@1.0.0 build c:\Dev\github\netlify-blog npm run clean && gatsby build
This is how I normally run & it fails
netlify-blog@1.0.0 build C:\Dev\github\netlify-blog npm run clean && gatsby build
I did a cd to change to the capital drive letter & the build completed.
Both were done in the standard windows terminal.
So is this a problem with how the gatsby CLI handles the drive letter?
Yeah. File deduplication doesn't work because the library we use for path normalization doesn't handle drive letters (and maybe it shouldn't). As a result, we assume that you have two template files with identical content hence the error.
@vladar Thanks for your help. I set my terminal to start in the capitalized directory so I shouldn't see the problem anymore.
I'm having this exact issue and I have no idea how to solve it.
ERROR #85910 GRAPHQL
Multiple "root" queries found in file: "cSomeFile" and "cSomeFile". Only the first ("cSomeFile") will be registered.
These queries are the same files. Can someone please help me solve this issue? I have my graphQl in the index.js:
import React from "react"; import { Link, graphql } from "gatsby";
import Layout from "../components/layout"; import SEO from "../components/seo"; // import Hero from '../components/Globals/Hero'; import Info from '../components/home/Info'; import BackgroundSection from "../components/Globals/BackgroundSection";
const IndexPage = ({data}) => (
);
export const query = graphql{ img:file(relativePath:{eq:"cbg2.jpg"}) { childImageSharp { fluid(maxWidth: 400, maxHeight: 250) { ...GatsbyImageSharpFluid } } } menu:allContentfulCoffeeItem{ edges{ node{ id title description{ description } price category image{ fixed(width:50,height:50){ ...GatsbyContentfulFixed_tracedSVG } } } } } }
export default IndexPage
@Mognoid3r you just need to cd to your base directory with a capital drive letter before building. cd C:\path\to\gatsby npm run build
Forgive me but how do you do that? i'm new to all this. I use the terminal inside of VSC but when I git clone I do that out of git bash.
@Mognoid3r What command are you running when you get the error? What does your prompt look like on the place you issue that command?
I was seeing this problem when running npm run build from the windows terminal.
Inside VSC I open up my terminal inside of the root of my project and I use the command gatsby develop.
@Mognoid3r Cut & paste what your VSC terminal looks like when you first open it.
Holis@DESKTOP-VA208DU MINGW64 ~/Desktop/practice/Test-Coffee-Repo (master) $
@Mognoid3r Your VSC terminal is using git bash, which I am not very familiar with, but try these commands:
cd /C/Users/Holis/Desktop/practice/Test-Coffee-Repo gatsby develop
I just hit this where I had 2 hook exports in the same file. Not sure why it is an issue but in the end I separated the exports into their own files combining them in the index.js
file of the directory:
// /hooks/index.js
export { default as useSiteMeta } from './useSiteMeta';
export { default as useContactDetails } from './useContactDetails';
I'm also seeing the Multiple "root" queries found in file
error but in a new project.
This occurs with a template component shadowed from a theme. Are we supposed to rename queries when we shadow components (or just components containing page queries)? This is the sort of thing that would probably be obvious to everyone but me! I haven't seen it documented anywhere.
See Issue #2 in this demo repo.
I am also on Windows (see below), but the cd/base directory trick didn't change anything for me.
Cheers -
System:
OS: Windows 10 10.0.17763
CPU: (8) x64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
Binaries:
Node: 12.13.0 - ~\AppData\Local\Temp\yarn--1575659192406-0.508817745209361\node.CMD
Yarn: 1.19.1 - ~\AppData\Local\Temp\yarn--1575659192406-0.508817745209361\yarn.CMD
npm: 6.12.0 - C:\Program Files\nodejs\npm.CMD
Languages:
Python: 3.7.2 - /c/Users/r2dfoo/AppData/Local/Programs/Python/Python37/python
Browsers:
Edge: 44.17763.831.0
@andrejarboe Are you on Windows as well?
Yes I am on windows
Do I need to switch to Linux or Mac?
@vladar Thanks for your help. I set my terminal to start in the capitalized directory so I shouldn't see the problem anymore.
How do you make it start with the capital C automatically?
@andrejarboe for command prompt or powershell, just set the "start in" directory on the shortcut you use to have a capital drive letter. For Git Bash, there doesn't seem to be a good way as it always forces the drive letter to lower case outside of doing a "cd /C"
I had this "hair puller" too, gave up and used CMD CLI rather than bash :(
Thanks for the help. I had this issue using powershell PS D:\Source\Dev\gatsby-starter-blog\ After wasting lots of time, gave up and used cmd rather than powershell.
Experiencing the "Multiple "root" queries found in file" problem on macOS. Downgrading gatsby to version 2.17.* did not help - the error changed to "Encountered duplicate defintitions for one or more documents: each document must have a unique name"
@Nurou Yours sounds like a different problem because this one is windows-specific (and the bug here is that Gatsby finds a duplicate query in the same file).
In your situation, this message may indicate a real error in your code. So please post a full output of your error message.
The fix is published in gatsby-cli@2.8.27
Just encountered this on Windows 10 while running Gatsby CLI 2.8.29. It was working fine last night. Booted my laptop today and all of a sudden Gatsby is telling me I've got multiple queries in my index.js. It builds fine in Git Bash or cmd.
Repo link: https://github.com/RapidOwl/samstrong-dot-dev
Update: This works fine in Git Bash stand alone, but when running Git Bash through Windows Terminal this fails.
@dan-mba it maybe would be related to a filenames conflict I had, I just got it solved, I hope it helps.
Has anyone found the solution to this issue? I'm running the latest version of gatsby-cli
and still seem to get this error every time. All of my filenames are unique. I am running on Windows 10.
I had this issue while using the terminal in VS Code. Seems like it's case sensitive, so make sure the drive letter and all the folders match the actual cases.
So for me, the issue occurred because I had initially navigated to my destination folder by using a lower case "b" for my blog folder when I had created it with a capital "B". I fixed it by changing blog to Blog as per below:
From: C:\Documents\blog\gatsby-blog
To: C:\Documents\Blog\gatsby-blog
Hope this helps.
I had this issue while using the terminal in VS Code. Seems like it's case sensitive, so make sure the drive letter and all the folders match the actual cases.
So for me, the issue occurred because I had initially navigated to my destination folder by using a lower case "b" for my blog folder when I had created it with a capital "B". I fixed it by changing blog to Blog as per below:
From: C:\Documents\blog\gatsby-blog
To: C:\Documents\Blog\gatsby-blog
Hope this helps.
I was facing the same issue on my Windows 10 machine, and indeed is a case sensitivity thing, in my case I changed the letter "d" in C:\Users\leoc\documents\ to C:\Users\leoc\Documents\ and it built successfully in the powershell terminal on VSCode.
'gatsby clean' solved the issue I had the same issue when I was running an application on localhost (on Windows). I cleaned the cache using gatsby clean and re-started the application. It solved the issue.
I had this issue while using the terminal in VS Code. Seems like it's case sensitive, so make sure the drive letter and all the folders match the actual cases.
So for me, the issue occurred because I had initially navigated to my destination folder by using a lower case "b" for my blog folder when I had created it with a capital "B". I fixed it by changing blog to Blog as per below:
From: C:\Documents\blog\gatsby-blog
To: C:\Documents\Blog\gatsby-blog
Hope this helps.
I m new for gatsby and I m using Windows 10, changing path words beginning letter with capital letter works for me, e.g. c://Users/me_/Documents/React/my-blog, both git-bash, windows terminal and vscode terminal
Description
I was seeing the problem described in #19748 , but after npm update picked up 2.18.5 the build failed with a different error (which was repeated for several files):
ERROR #85910 GRAPHQL
Multiple "root" queries found in file: "IndexPageTemplate" and "IndexPageTemplate". Only the first ("IndexPageTemplate") will be registered.
Instead of: 1 | query IndexPageTemplate { 2 | bar { 3 | #... 4 | } 5 | } 6 | 7 | query IndexPageTemplate { 8 | foo { 9 | #... 10 | } 11 | }
Do: 1 | query indexPageTemplateAndIndexPageTemplate { 2 | bar { 3 | #... 4 | } 5 | foo { 6 | #... 7 | } 8 | }
File: src\templates\index-page.js
Steps to reproduce
Expected result
build should complete
Actual result
build failed
Environment
System: OS: Windows 8.1 6.3.9600 CPU: (4) x64 Intel(R) Core(TM) i5-4460S CPU @ 2.90GHz Binaries: Node: 12.13.1 - C:\Program Files\nodejs\node.EXE npm: 6.12.1 - C:\Program Files\nodejs\npm.CMD Languages: Python: 3.8.0 npmPackages: gatsby: ^2.18.5 => 2.18.5 gatsby-image: ^2.2.34 => 2.2.34 gatsby-plugin-netlify: ^2.1.27 => 2.1.27 gatsby-plugin-netlify-cms: ^4.1.30 => 4.1.30 gatsby-plugin-purgecss: ^4.0.0 => 4.0.1 gatsby-plugin-react-helmet: ^3.1.16 => 3.1.16 gatsby-plugin-sass: ^2.1.24 => 2.1.24 gatsby-plugin-sharp: ^2.3.4 => 2.3.4 gatsby-remark-copy-linked-files: ^2.1.31 => 2.1.31 gatsby-remark-images: ^3.1.34 => 3.1.34 gatsby-remark-relative-images: ^0.2.1 => 0.2.3 gatsby-source-filesystem: ^2.1.39 => 2.1.39 gatsby-transformer-remark: ^2.6.38 => 2.6.38 gatsby-transformer-sharp: ^2.3.6 => 2.3.6