graphql-prisma-typescript icon indicating copy to clipboard operation
graphql-prisma-typescript copied to clipboard

Multiple instances of "graphql"

Open jnak opened this issue 6 years ago • 1 comments

On a fresh install, I get this error when running yarn dev:

yarn dev
yarn run v1.10.1
$ npm-run-all --parallel start playground
$ nodemon -e ts,graphql -x ts-node --no-cache -r dotenv/config src/index.ts
$ graphql playground
[nodemon] 1.18.11
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `ts-node --no-cache -r dotenv/config src/index.ts`
Serving playground at http://localhost:3000/playground
Server is running on http://localhost:4000
Error: Cannot use GraphQLSchema "[object GraphQLSchema]" 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/julien/code/graphql-prisma-typescript/node_modules/graphql/jsutils/instanceOf.js:37:13)
    at isSchema (/Users/julien/code/graphql-prisma-typescript/node_modules/graphql/type/schema.js:34:34)
    at assertSchema (/Users/julien/code/graphql-prisma-typescript/node_modules/graphql/type/schema.js:38:4)
    at validateSchema (/Users/julien/code/graphql-prisma-typescript/node_modules/graphql/type/validate.js:53:28)
    at assertValidSchema (/Users/julien/code/graphql-prisma-typescript/node_modules/graphql/type/validate.js:77:16)
    at Object.validate (/Users/julien/code/graphql-prisma-typescript/node_modules/graphql/validation/validate.js:55:35)
    at doRunQuery (/Users/julien/code/graphql-prisma-typescript/node_modules/apollo-server-core/src/runQuery.ts:181:30)
    at /Users/julien/code/graphql-prisma-typescript/node_modules/apollo-server-core/src/runQuery.ts:80:39
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
Error: Cannot use GraphQLSchema "[object GraphQLSchema]" from another module or realm.

I suspect this is because renovate-bot automatically upgrades dependencies and there are no tests setup in this repo.

jnak avatar Apr 17 '19 15:04 jnak

FYI I reverted to https://github.com/prisma/graphql-prisma-typescript/commit/2d4994cec0b5c0b4f3c5ff1d0372dd0e1cea166f and it seems to work fine. I had to use npm install thought because yarn was failing:

error An unexpected error occurred: "https://registry.yarnpkg.com/flatmap-stream/-/flatmap-stream-0.1.2.tgz: Request failed \"404 Not Found\"".

jnak avatar Apr 17 '19 15:04 jnak