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: duplicate "graphql" modules in Gatsby v2 #22

Open
jackdbd opened this issue Sep 4, 2018 · 3 comments
Open

Error: duplicate "graphql" modules in Gatsby v2 #22

jackdbd opened this issue Sep 4, 2018 · 3 comments

Comments

@jackdbd
Copy link

jackdbd commented Sep 4, 2018

I was trying to configure this plugin in a Gatsby v2 website and received this message:

Ensure that there is only one instance of "graphql" in the node_modules directory.
If different versions of "graphql" are the dependencies of other relied on modules,
use "resolutions" to ensure only one version is installed.

And then...

https://yarnpkg.com/en/docs/selective-version-resolutions

Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.

Error: Cannot use GraphQLObjectType "SitePageConnection" from another module or realm.
Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.
https://yarnpkg.com/en/docs/selective-version-resolutions
Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.

Here is what I did:

  1. Created a new Gatsby website, starting from the official blog v2 template
gatsby new my-blog https://github.com/gatsbyjs/gatsby-starter-blog#v2
  1. Created a Search React component and copy-pasted the code available in
    the Consuming your site section.

  2. Updated gatsby-config.js as explained here.

I'm not sure how to use the selective version resolution. In the documentation they say to add a resolutions field in package.json and then run npm install. This is what I tried (with no luck).

"resolutions": {
    "@andrew-codes/**/graphql": "0.13.0",
    "[email protected]/**/graphql": "0.10.3"
  }

Have I misunderstood how to use this plugin or this behavior is due to changes in Gatsby v2?

@krismorf
Copy link

krismorf commented Sep 5, 2018

Gatsby v2 is not supported yet. See #14

@DHFW
Copy link

DHFW commented Jan 21, 2019

It is supported now, see #14 for more details

@calamarico
Copy link

calamarico commented Jan 22, 2019

@DHFW Will be supported when merge right?
...
Ok I see the publish npm install --save @gatsby-contrib/gatsby-plugin-elasticlunr-search perfect!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants