mattbishop / graphql-workshop

GraphQL / Event Modeling workshop project
8 stars 16 forks source link

Unable to generate-types #1

Closed darranhayes closed 3 years ago

darranhayes commented 3 years ago

Hi Matt, I've no expectation on you to try and fix this, I'm reaching out in case you happen to already know a fix from experience, and if you can share I'd be very grateful.

I'm on windows 10, running node v14.15.1 (was running v12.* earlier, same problem), and I'm not able to generate-types on a clone of your repo, with a fresh npm install. Error included below.

I've also tried "npm ci" to install only the exact specified versions from your package-lock.json, I've switched to yarn and tried looking for the conflicting dependencies where possible, all with no joy. I also cannot find a recent version of this issue on the code-gen/cli repository, although they had it last year.

Can you share your OS and NodeJS & NPM versions, and if different, then I'll set up a similar WSL instance and try again.

Thanks for any help! D

$ npm run generate-types

table-tennis@1.0.0 generate-types C:\Users\darra\src\EventDrivenWorkshop\graphql-workshop graphql-codegen

[17:06:54] Parse configuration [started] [17:06:54] Parse configuration [completed] [17:06:54] Generate outputs [started] [17:06:54] Generate src/graphql/gen/types.d.ts [started] [17:06:54] Load GraphQL schemas [started] [17:06:54] Load GraphQL schemas [completed] [17:06:54] Load GraphQL documents [started] [17:06:54] Load GraphQL documents [completed] [17:06:54] Generate [started] [17:06:55] Generate [failed] [17:06:55] → Cannot use GraphQLEnumType "__TypeKind" 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

mattbishop commented 3 years ago

I haven't seen this before. Did you edit the schema?

Also you have a yarn doc there, you might try using yarn if you are familiar with it rather than npm. I usually do.

mattbishop commented 3 years ago
⋊> ~/P/A/w/G/graphql-workshop on main ◦ npm run generate-types          17:46:49

> table-tennis@1.0.0 generate-types /Users/matt/Projects/Adaptech/workshop/GraphQL/graphql-workshop
> graphql-codegen

  ✔ Parse configuration
  ✔ Generate outputs
⋊> ~/P/A/w/G/graphql-workshop on main ◦ npm -version                    17:47:03
6.14.8
⋊> ~/P/A/w/G/graphql-workshop on main ◦ node --version                  17:47:11
v12.19.0
mattbishop commented 3 years ago

Also on MacOS 11.0.1

mattbishop commented 3 years ago

If you tried yarn, delete node_modules first.

darranhayes commented 3 years ago

Thanks Matt. I tried nuking node_modules, switched to yarn, used various tricks to look for the clash. At this stage I think it's an environment specific issue. I'll spin up a Linux environment and see if there's a change. Thanks again.