Graphql-tools: `apollo-link` dependency causing multiple versions of `graphql` under `node_modules`

Created on 10 Oct 2017  路  11Comments  路  Source: ardatan/graphql-tools

Since this PR:
https://github.com/apollographql/graphql-tools/pull/409

My server is using graphql 0.11.7, and latest graphql-tools, and now it comes with a dependency for apollo-link, causing my node_modules have multiple copies for GraphQL:

./node_modules/apollo-server-core/node_modules/graphql
./node_modules/apollo-link/node_modules/graphql
./node_modules/graphql

Causing the server to throw:

```
Schema must be an instance of GraphQLSchema. Also ensure that there are not multiple versions of GraphQL installed in your node_modules directory.
````

Most helpful comment

Also, as a note, the current declaration of apollo-link as a dev dependency cause the following typescript error since it is not installed by default. Changing it to a peer dependency would solve this problem as well.

node_modules/graphql-tools/dist/stitching/introspectSchema.d.ts(2,28): error TS2307: Cannot find module 'apollo-link'.
node_modules/graphql-tools/dist/stitching/makeRemoteExecutableSchema.d.ts(1,28): error TS2307: Cannot find module 'apollo-link'.

All 11 comments

I believe this would require changing apollo-link to list graphql as a peer dependency (may be in progress here: https://github.com/apollographql/apollo-link/issues/78) and then updating to use the newer apollo-link. This is a similar problem to what react encountered early on, and now most react libraries list react as a peer dependency.

Ping @jbaxleyiii @peggyrayzis

Also, as a note, the current declaration of apollo-link as a dev dependency cause the following typescript error since it is not installed by default. Changing it to a peer dependency would solve this problem as well.

node_modules/graphql-tools/dist/stitching/introspectSchema.d.ts(2,28): error TS2307: Cannot find module 'apollo-link'.
node_modules/graphql-tools/dist/stitching/makeRemoteExecutableSchema.d.ts(1,28): error TS2307: Cannot find module 'apollo-link'.

Any updates ?

Should be fixed in 2.7.0.

Seems broken in 2.7.1

I agree that it's broken in 2.7.1. In previous version (2.5.1) there was no problem with it:

node_modules/graphql-tools/dist/stitching/introspectSchema.d.ts(2,28): error TS2307: Cannot find module 'apollo-link'.
node_modules/graphql-tools/dist/stitching/makeRemoteExecutableSchema.d.ts(1,28): error TS2307: Cannot find module 'apollo-link'.

We had to remove apollo-link from peer dependencies, because nested peer dependencies broke on some environments. graphql-tools only needs apollo-link types, so for typescript you can just install it as devDependency. I'm sorry for the inconvenience.

I was referring to original issue when I said it was fixed. Sorry, I didn't read further messages :)

As the original issue is not fixed via the change of dependency, I have created a new issue (#472) for this particular problem.

The dependency is gone, but there is indeed a new issue with TypeScript. Thanks for opening a new issue!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

flippidippi picture flippidippi  路  3Comments

adamkl picture adamkl  路  3Comments

alfaproject picture alfaproject  路  4Comments

ericclemmons picture ericclemmons  路  4Comments

capaj picture capaj  路  4Comments