Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: RelayParser: Encountered duplicate defintitions for one or more documents #11688

Closed
ChildishhAlbino opened this issue Feb 11, 2019 · 11 comments

Comments

Projects
None yet
6 participants
@ChildishhAlbino
Copy link

commented Feb 11, 2019

Description

Building a blog / portfolio with GatsbyJS and I'm struggling with this issue. I had the website working for the most part but all of a sudden it's stopped working. Really not sure why. The error doesn't make much sense to me. Hoping someone cold help me work out why.

Steps to reproduce

https://github.com/ChildishhAlbino/childishhalbino.github.io/tree/problem-fixing

Above is a git repo with the project as I last left it.

  1. run NPM install for node packages
  2. Run gatsby develop.
  3. Visit localhost/8000

An error screen should appear with the above error.

Expected result

  • Page should load without errors.
  • There should be 3 blog posts with the content from the /posts/ markdown files.
  • The 'about' tab should display 3 'cards' each with information from the /bio/ markdown files.
  • The blurb should load with information from the 'blurb.md' file.

There will be warnings. There are some imports that aren't being used but aside from that everything should be fine.

Actual result

  • Page will not load -> returns above error.
  • Unsure how else to describe the issue.

Environment

Run npx gatsby info --clipboard in your project directory and paste the output here.

System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz
Binaries:
npm: 6.4.1 - D:\Software Development\Languages, Frameworks,
etc\nodeJs\npm.CMD
Languages:
Python: 3.7.0 - C:\Users\conno\AppData\Local\Programs\Python\Python37-32\python.EXE
Browsers:
Edge: 42.17134.1.0
npmPackages:
gatsby: ^2.0.118 => 2.0.118
gatsby-image: ^2.0.19 => 2.0.29
gatsby-plugin-buildtime-timezone: ^1.0.3 => 1.0.3
gatsby-plugin-manifest: ^2.0.7 => 2.0.17
gatsby-plugin-offline: ^2.0.23 => 2.0.23
gatsby-plugin-react-helmet: ^3.0.1 => 3.0.6
gatsby-plugin-sass: ^2.0.2 => 2.0.10
gatsby-plugin-sharp: ^2.0.11 => 2.0.20
gatsby-source-filesystem: ^2.0.6 => 2.0.20
gatsby-transformer-remark: ^2.2.4 => 2.2.4
gatsby-transformer-sharp: ^2.1.7 => 2.1.13

error The system cannot find the path specified.

Error: The system cannot find the path specified.

  • envinfo.js:1 Function.e.exports.sync
    [childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:4970

  • envinfo.js:1 Object.copySync
    [childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:6694 8

  • envinfo.js:1 Object.t.writeSync.e [as writeSync]
    [childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:4877 7

  • envinfo.js:1
    [childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:4693 4

  • envinfo.js:1 Promise.all.then.e
    [childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:4694 9

  • util.js:16 tryCatcher
    [childishhalbino.github.io]/[bluebird]/js/release/util.js:16 :23

  • promise.js:512 Promise._settlePromiseFromHandler
    [childishhalbino.github.io]/[bluebird]/js/release/promise.js :512:31

  • promise.js:569 Promise._settlePromise
    [childishhalbino.github.io]/[bluebird]/js/release/promise.js :569:18

  • promise.js:614 Promise._settlePromise0
    [childishhalbino.github.io]/[bluebird]/js/release/promise.js :614:10

  • promise.js:694 Promise._settlePromises
    [childishhalbino.github.io]/[bluebird]/js/release/promise.js :694:18

  • promise.js:638 Promise._fulfill
    [childishhalbino.github.io]/[bluebird]/js/release/promise.js :638:18

  • promise_array.js:126 PromiseArray._resolve
    [childishhalbino.github.io]/[bluebird]/js/release/promise_ar ray.js:126:19

  • promise_array.js:144 PromiseArray._promiseFulfilled
    [childishhalbino.github.io]/[bluebird]/js/release/promise_ar ray.js:144:14

  • promise.js:574 Promise._settlePromise
    [childishhalbino.github.io]/[bluebird]/js/release/promise.js :574:26

  • promise.js:614 Promise._settlePromise0
    [childishhalbino.github.io]/[bluebird]/js/release/promise.js :614:10

  • promise.js:694 Promise._settlePromises
    [childishhalbino.github.io]/[bluebird]/js/release/promise.js :694:18

error UNHANDLED REJECTION

Error: The system cannot find the path specified.

  • envinfo.js:1 Function.e.exports.sync
    [childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:4970

  • envinfo.js:1 Object.copySync
    [childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:6694 8

  • envinfo.js:1 Object.t.writeSync.e [as writeSync]
    [childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:4877 7

  • envinfo.js:1
    [childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:4693 4

  • envinfo.js:1 Promise.all.then.e
    [childishhalbino.github.io]/[envinfo]/dist/envinfo.js:1:4694 9

  • util.js:16 tryCatcher
    [childishhalbino.github.io]/[bluebird]/js/release/util.js:16 :23

  • promise.js:512 Promise._settlePromiseFromHandler
    [childishhalbino.github.io]/[bluebird]/js/release/promise.js :512:31

  • promise.js:569 Promise._settlePromise
    [childishhalbino.github.io]/[bluebird]/js/release/promise.js :569:18

  • promise.js:614 Promise._settlePromise0
    [childishhalbino.github.io]/[bluebird]/js/release/promise.js :614:10

  • promise.js:694 Promise._settlePromises
    [childishhalbino.github.io]/[bluebird]/js/release/promise.js :694:18

  • promise.js:638 Promise._fulfill
    [childishhalbino.github.io]/[bluebird]/js/release/promise.js :638:18

  • promise_array.js:126 PromiseArray._resolve
    [childishhalbino.github.io]/[bluebird]/js/release/promise_ar ray.js:126:19

  • promise_array.js:144 PromiseArray._promiseFulfilled
    [childishhalbino.github.io]/[bluebird]/js/release/promise_ar ray.js:144:14

  • promise.js:574 Promise._settlePromise
    [childishhalbino.github.io]/[bluebird]/js/release/promise.js :574:26

  • promise.js:614 Promise._settlePromise0
    [childishhalbino.github.io]/[bluebird]/js/release/promise.js :614:10

  • promise.js:694 Promise._settlePromises
    [childishhalbino.github.io]/[bluebird]/js/release/promise.js :694:18

@pieh

This comment has been minimized.

Copy link
Contributor

commented Feb 11, 2019

This is defenitely a bug in gatsby.

For now you can workaround this by changing line in https://github.com/ChildishhAlbino/childishhalbino.github.io/blob/problem-fixing/gatsby-node.js#L34
to:

component: path.resolve(`./src/components/Blog/BlogPostTemplate/blogPostTemplate.js`),

(I adjusted file/directory names casing to match one that exists in repository). It will get you pass that graphql error, but there will be some additional fixes needed elsewhere too because I hit:

error Building static HTML failed for path "/GatsbyJS and Web development/"

See our docs page on debugging HTML builds for help https://gatsby.app/debug-html

  11 |                  <div className="blurb">
  12 |                          <Image fluid={data.image.childImageSharp.fluid} />
> 13 |                          <Markdown source={data.blurb.childMarkdownRemark.rawMarkdownBody} />
     |                                                                           ^
  14 |                  </div>
  15 |          )}
  16 |  />


  WebpackError: TypeError: Cannot read property 'rawMarkdownBody' of null

But this is not really related to issue itself.

I will start working on fix to handle casing differences and to not throw this confusing error message.

@ChildishhAlbino

This comment has been minimized.

Copy link
Author

commented Feb 11, 2019

Thanks for working that out for me! I actually didn't think it was a bug in Gatsby but whaddya know? ]

Quickly worked out those errors and the sites working again!

Thanks heaps :D

Have a nice day, good luck fixing the bug!

@imshuffling

This comment has been minimized.

Copy link
Member

commented Feb 13, 2019

i think I'm having a similar issue, any update on a fix for this?

@pieh

This comment has been minimized.

Copy link
Contributor

commented Feb 13, 2019

@imshuffling hopefully I'll open PR today. Just to confirm if your issue have similar root problem - are you on Mac? Because it seems that on Linux and Windows when you use wrong casing for component argument in createPage we will throw error saying that file can't be found.

@imshuffling

This comment has been minimized.

Copy link
Member

commented Feb 13, 2019

@pieh Yeah I'm on a mac, i've logged a issue here - it may be related #11732

@pieh

This comment has been minimized.

Copy link
Contributor

commented Feb 13, 2019

Oh, this seems different. Error from this is:
Error: RelayParser: Encountered duplicate defintitions for one or more documents

@AlexanderProd

This comment has been minimized.

Copy link
Member

commented Feb 16, 2019

I'm encountering the same bug as well when I create a new gatsby project using this starter and run gatsby develop.

My error message:

GraphQL Error There was an error while compiling your site's GraphQL queries.
  Error: RelayParser: Encountered duplicate defintitions for one or more documents: each document must have a unique name. Duplicated documents:
- usersAlexanderhoerlSitesBiobalanceSrcTemplatesProductPageIndexJs721922104

I'm also on mac.

System:
  OS: macOS 10.14.3
  CPU: (8) x64 Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz
  Shell: 3.2.57 - /bin/bash
Binaries:
  Node: 11.7.0 - /usr/local/bin/node
  Yarn: 1.13.0 - /usr/local/bin/yarn
  npm: 6.5.0 - /usr/local/bin/npm
Languages:
  Python: 2.7.10 - /usr/bin/python
Browsers:
  Chrome: 72.0.3626.109
  Safari: 12.0.3
npmPackages:
  gatsby: ^2.0.111 => 2.0.111 
  gatsby-image: ^2.0.20 => 2.0.25 
  gatsby-plugin-google-analytics: ^2.0.13 => 2.0.13 
  gatsby-plugin-layout: ^1.0.11 => 1.0.11 
  gatsby-plugin-manifest: ^2.0.9 => 2.0.12 
  gatsby-plugin-offline: ^2.0.16 => 2.0.20 
  gatsby-plugin-react-helmet: ^3.0.6 => 3.0.6 
  gatsby-plugin-sharp: ^2.0.14 => 2.0.16 
  gatsby-source-filesystem: ^2.0.8 => 2.0.12 
  gatsby-source-shopify2: ^2.0.7 => 2.0.7 
  gatsby-transformer-sharp: ^2.1.8 => 2.1.9 

@pieh

This comment has been minimized.

Copy link
Contributor

commented Feb 16, 2019

@AlexanderProd From quick look it seems like same issue. This is because
file path casing in https://github.com/AlexanderProd/gatsby-shopify-starter/blob/cff5d01029e514cf9ac8ac70987d01cd03a16f82/gatsby-node.js#L19
doesn't match casing exactly:

in gatsby-node: component: path.resolve(`./src/templates/ProductPage/index.js`),
in filesystem:                             src/templates/productPage/index.js
                                                         ^ one `p` is uppercase other is lower case

so as a workaround, adjusting path in gatsby-node should fix this.

@AlexanderProd

This comment has been minimized.

Copy link
Member

commented Feb 18, 2019

@AlexanderProd From quick look it seems like same issue. This is because
file path casing in https://github.com/AlexanderProd/gatsby-shopify-starter/blob/cff5d01029e514cf9ac8ac70987d01cd03a16f82/gatsby-node.js#L19
doesn't match casing exactly:

in gatsby-node: component: path.resolve(`./src/templates/ProductPage/index.js`),
in filesystem:                             src/templates/productPage/index.js
                                                         ^ one `p` is uppercase other is lower case

so as a workaround, adjusting path in gatsby-node should fix this.

I've noticed when I change it to a small p building and developing works on Ubuntu machines but not on macOS, what makes it pretty difficult to develop on a mac and build on a linux server.

@ZolderonGitHub

This comment has been minimized.

Copy link

commented Jun 17, 2019

i have same problem

@CongLiu-CN

This comment has been minimized.

Copy link

commented Jul 15, 2019

I met the same error.
The problem is because I was using Hyper terminal in windows.
Solution is using the default terminal in windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.