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

Ensure that there is only one instance of "graphql" in the node_modules directory #136

Closed
peterschussheim opened this issue Feb 17, 2018 · 3 comments

Comments

@peterschussheim
Copy link

Problem

Setting up a new server using advanced TS example (via prisma cli) throws the following error:

Error: Cannot use GraphQLSchema "[object Object]" 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.
    at instanceOf (/Users/peter/Sources/Repos/notes/packages/notes-prisma-local/node_modules/graphql/jsutils/instanceOf.js:17:13)
    at isSchema (/Users/peter/Sources/Repos/notes/packages/notes-prisma-local/node_modules/graphql/type/schema.js:48:35)
    at validateSchema (/Users/peter/Sources/Repos/notes/packages/notes-prisma-local/node_modules/graphql/type/validate.js:51:25)
    at assertValidSchema (/Users/peter/Sources/Repos/notes/packages/notes-prisma-local/node_modules/graphql/type/validate.js:76:16)
    at Object.validate (/Users/peter/Sources/Repos/notes/packages/notes-prisma-local/node_modules/graphql/validation/validate.js:61:35)
    at doRunQuery (/Users/peter/Sources/Repos/notes/packages/notes-prisma-local/node_modules/apollo-server-core/src/runQuery.ts:143:30)
    at /Users/peter/Sources/Repos/notes/packages/notes-prisma-local/node_modules/apollo-server-core/src/runQuery.ts:69:39
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)

Workaround

As per the following suggestion, adding a resolutions key to the package.json of the newly initialized project fixes the issue:

"resolutions": {
    "graphql": "^0.13.0"
  }

Related

@moritzmorgenroth
Copy link

The workaround works locally, however does not appear to work when deploying to now.

@marktani
Copy link
Contributor

Hey @peterschussheim and @moritzmorgenroth, thanks for chiming in here! Could you please try the steps outlined in this comment? Let me know if that doesn't fix the problem for you 🙂

@marktani
Copy link
Contributor

marktani commented May 7, 2018

This should be resolved by now 🙂

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