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 cannot be used at the same time #61

Open
maximelebreton opened this issue Sep 8, 2022 · 1 comment

Comments

@maximelebreton
Copy link

Hello @Stun3R,
and thanks for your work.

I have this error when I try to generate types:

Error: Cannot use GraphQLObjectType "Article" 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.

package.json

  "dependencies": {
    "@strapi/plugin-graphql": "4.2.3",
    "@strapi/strapi": "4.2.3",
    "strapi-generate-types": "^0.1.4",
  }

Any ideas how to fix this?

Thanks!

@maximelebreton
Copy link
Author

Fixed by modifying the strapi-generate-types/package.json from this:

"dependencies": {
    "@graphql-codegen/core": "1.17.10",
    "@graphql-codegen/typescript": "1.22.3",
    "@graphql-tools/load": "6.2.8",
    "@graphql-tools/url-loader": "6.10.1",
    "@types/fs-extra": "9.0.11",
    "graphql": "15.5.1"

to this:

"dependencies": {
    "@graphql-codegen/core": "^1.17.10",
    "@graphql-codegen/typescript": "^1.22.3",
    "@graphql-tools/load": "^6.2.8",
    "@graphql-tools/url-loader": "^6.10.1",
    "graphql": "^15.5.1",

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

1 participant