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

Subscription gives me an error message: "Cannot use GraphQLSchema \"[object Object]\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory..." #647

Closed
knixer opened this issue Jul 20, 2020 · 2 comments

Comments

@knixer
Copy link

knixer commented Jul 20, 2020

When I try to use subscription in graphiql I get this error message:

{
  "error": {
    "message": "Cannot use GraphQLSchema \"[object Object]\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results."
  }
}

npm ls | grep graphql gives:

[email protected] /graphql-server
├── [email protected]
├─┬ [email protected]
│ ├─┬ @types/[email protected]
│ │ └── [email protected] deduped
│ ├── @types/[email protected]
│ │ │ │ ├── UNMET PEER DEPENDENCY [email protected] - 0.13.x
│ │ │ │ └── [email protected] deduped
│ │ │ │ ├── UNMET PEER DEPENDENCY [email protected] - 0.13.x
│ │ │ │ └── [email protected] deduped
│ │ │ ├── UNMET PEER DEPENDENCY [email protected] - 0.13.x
│ │ │ └─┬ [email protected]
│ │ └── UNMET PEER DEPENDENCY graphql@^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0
│ │ └── UNMET PEER DEPENDENCY graphql@^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0
│ ├─┬ [email protected]
│ ├─┬ UNMET PEER DEPENDENCY [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ ├─┬ [email protected]
│ ├─┬ [email protected]
│ ├─┬ [email protected]
npm ERR! peer dep missing: [email protected] - 14, required by [email protected]
npm ERR! peer dep missing: graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0, required by [email protected]
npm ERR! peer dep missing: graphql@^0.12.0 || ^0.13.0 || ^14.0.0, required by [email protected]
npm ERR! peer dep missing: graphql@^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0, required by [email protected]
npm ERR! peer dep missing: [email protected] - 14, required by [email protected]
npm ERR! peer dep missing: aws-lambda@^0.1.2, required by [email protected]
npm ERR! peer dep missing: graphql@^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0, required by [email protected]
npm ERR! peer dep missing: [email protected] - 0.13.x, required by [email protected]
npm ERR! peer dep missing: [email protected] - 0.13.x, required by [email protected]
npm ERR! peer dep missing: [email protected] - 0.13.x, required by [email protected]
npm ERR! peer dep missing: [email protected] - 0.13.x, required by [email protected]
npm ERR! peer dep missing: [email protected] - 0.13.x, required by [email protected]
npm ERR! peer dep missing: graphql@^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0, required by [email protected]

When npm install graphql:

npm WARN [email protected] requires a peer of [email protected] - 0.13.x but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] - 0.13.x but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] - 14 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] - 0.13.x but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.12.0 || ^0.13.0 || ^14.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of aws-lambda@^0.1.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of graphql@^0.10.5 || ^0.11.3 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] - 14 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ [email protected]
updated 1 package and audited 291 packages in 2.907s

I have tried changing graphql version by: npm install [email protected], which gives less error messages, both in initial install and "npm ls | grep grapql". However, subscription does still not work...

Before that, I have deleted the node_modules folder and package-lock.json. Re-installing with npm install. But The same error occurs. Finally I have tried to add resolution to my package.json file with no luck:


"resolutions": {
    "graphql": "^15.3.0"
  }
@chungquantin
Copy link

Same issue happens to me!

@saihaj saihaj mentioned this issue Dec 5, 2021
32 tasks
@saihaj
Copy link
Collaborator

saihaj commented Feb 19, 2022

Hey @knixer @chungquantin we @the-guild-org are the the new maintainers of this project and are actively developing v2. The new versions support subscriptions using Server Sent events and no need additional setup needed! Checkout our new docs https://www.graphql-yoga.com/docs/features/subscriptions. Would love to get your feedback on beta release. Thanks!

@saihaj saihaj closed this as completed Feb 19, 2022
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

3 participants