Ensure that there is only one instance of "graphql" in the node_modules directory
peterschussheim opened this issue · comments
Peter Schussheim commented
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" target="_blank" rel="nofollow
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
Moritz Morgenroth commented
The workaround works locally, however does not appear to work when deploying to now.
Nilan Marktanner commented
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 🙂
Nilan Marktanner commented
This should be resolved by now 🙂