gatsby-plugin-elasticlunr-search
gatsby-plugin-elasticlunr-search copied to clipboard
Error: duplicate "graphql" modules in Gatsby v2
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:
- Created a new Gatsby website, starting from the official blog v2 template
gatsby new my-blog https://github.com/gatsbyjs/gatsby-starter-blog#v2
-
Created a
Search
React component and copy-pasted the code available in the Consuming your site section. -
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?
Gatsby v2 is not supported yet. See #14
It is supported now, see #14 for more details
@DHFW Will be supported when merge right? ... Ok I see the publish npm install --save @gatsby-contrib/gatsby-plugin-elasticlunr-search perfect!