Duplicate GraphQL Error Out of Nowhere


#1

I downloaded an Apollo example repo, made a change to my datamodel, and now prisma generate won’t run. This is the error:

Generating schema… 48ms
{ parser: “babylon” } is deprecated; we now treat it as { parser: “babel” }.
▸ Cannot use GraphQLNonNull “BillWhereUniqueInput!” 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.

Get in touch if you need help: https://www.prisma.io/forum/
To get more detailed output, run $ export DEBUG="*"

I did not run any updates and didn’t install any additional packages nor did I update them. I checked process running on my ports and there are none. I restarted the terminal, restarted my os… I even reverted to old versions of the project that were previously stable.

I deleted my node_modules, as well as all generated files.

The only thing I can think of is that I tried removing the field “BillWhereUniqueInput!” from my schema file but then added it back after this error. I get the error whether it is there or not.

Right before this I also launched an Apollo tutorial on a different port, but again, checked those ports via lsof -i:4444 etc and got no return.

To complicate things, it says to use a yarn feature to resolve graphql, but I deleted yarn a long time ago as it started causing paaaiiinful and completely mysterious problems conflicting with npm. Yarn has turned into this weed I can’t ever seem to fully get rid of.

I’ve run out of things to try


#2

Hi this is not related to prisma.

Refer: https://stackoverflow.com/questions/53252347/duplicate-graphql-modules-cannot-be-used

Fix:

add

{
....
"resolutions":{
    "graphql":"^14.0.2"
},
}

to your package.json. Nuke your node_modules and run yarn install(Resolutions only work with yarn)


#3

I just can’t figure out why I’m only now having this issue if it’s really a duplicate instance, I didn’t install any packages before getting it. And deploy prisma is literally the only thing throwing an error.

But thanks, I’ll give it a try :slight_smile:


#4

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.