express-typescript-boilerplate icon indicating copy to clipboard operation
express-typescript-boilerplate copied to clipboard

GraphQL version issue on fresh install

Open camezcua12 opened this issue 5 years ago • 7 comments

Just cloned the repo and install everything using yarn run setup as according to the README.md, and configured my database on my .env file. So far so good.

When I run yarn start serve, everything works just fine, but if I try to get into the /graphql URL to start doing some GraphQL queries, I get the following error:

{ "errors": [ { "code": "500", "message": "Cannot use GraphQLSchema \"[object GraphQLSchema]\" 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." } ] }

Seems like a conflict between different dependencies requiring different versions of the GraphQL package. Also got this error after re-installing again on the same project with yarn install:

warning " > [email protected]" has incorrect peer dependency "graphql@^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0".

Currently I'm using [email protected] and [email protected], btw.

Any info regarding this issue? Thanks!

camezcua12 avatar May 06 '19 13:05 camezcua12

So I just did another fresh install in another folder, and figured out a couple things:

The first time I run yarn run setup I get this error from the event-stream package:

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

That unresolved URL comes actually from the yarn.lock file included in the repo. To make the installation work from there on, what I did is just erase the yarn.lock file and run the script again. Then it works.

But after that I get the GraphQL issue. So if I update the GraphQL package.json depency from v14.0.2 to v14.2.1, I can make the whole thing work.

Probably not a good idea to remove the whole yarn.lock file, but still is the only way I found to make it work.

camezcua12 avatar May 06 '19 13:05 camezcua12

OK, both event-stream and flatmap-stream packages in yarn.lock file were pointing to a 404 URL. After finding proper URLs for as similar versions as possible, everything works without any other tweaks (regarding the GraphQL issue, I mean).

Still not 100% sure if it's some thing I'm doing wrong or just some problem / outdated content with yarn.lock. Would like some input on this :+1:

camezcua12 avatar May 06 '19 13:05 camezcua12

So I just did another fresh install in another folder, and figured out a couple things:

The first time I run yarn run setup I get this error from the event-stream package:

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

That unresolved URL comes actually from the yarn.lock file included in the repo. To make the installation work from there on, what I did is just erase the yarn.lock file and run the script again. Then it works.

But after that I get the GraphQL issue. So if I update the GraphQL package.json depency from v14.0.2 to v14.2.1, I can make the whole thing work.

Probably not a good idea to remove the whole yarn.lock file, but still is the only way I found to make it work.

i have the exact same issue. how can i fix this with the correct way ?

dodistyo avatar May 16 '19 09:05 dodistyo

I don’t think there is any proper way to do it unless they update their package.json and package and yarn.lock files.

camezcua12 avatar May 17 '19 13:05 camezcua12

Can you add the specific versions of packages you added to make it work? I am having issues while trying to use GraphQL too! It sends the error you mentioned, but can't find duplicate versions of GraphQL in my node_modules folder. As you said, I first solved the event-stream and flatmap-stream by deleting yarn.lock and doing a fresh yarn install, however this didn't solved the GraphQL issue and it's really bugging my mind. Thanks in advance!

humbertowoody avatar May 17 '19 22:05 humbertowoody

Can you add the specific versions of packages you added to make it work? I am having issues while trying to use GraphQL too! It sends the error you mentioned, but can't find duplicate versions of GraphQL in my node_modules folder. As you said, I first solved the event-stream and flatmap-stream by deleting yarn.lock and doing a fresh yarn install, however this didn't solved the GraphQL issue and it's really bugging my mind. Thanks in advance!

please see #149

dodistyo avatar May 20 '19 12:05 dodistyo

Versions in the package.json should be locked down to a specific version. I ran into the GraphQL version conflict described above and also am seeing version issues with websockets, which is a dependency of event-dispatcher.

And, ideally all packages should be upgraded to modern versions.

Lovely framework!!! I've just spent too much time with npm version conflicts.

autumnfjeld avatar Oct 10 '19 01:10 autumnfjeld