Cannot import graphql-tools [SOLVED]

When attempting to import from the graphql-tools package, the app crashes to the red error screen with the following message:

Unable to resolve module graphql from /path/to/project/node_modules/graphql-tools/dist/schemaGenerator.js: Module does not exist in the module map

(N.B. The module path in the error can vary based on what you’re importing.)

It also mentions facebook/react-native#4968 but the seemingly accepted workaround steps do not appear to have any effect, plus it’s reproducible in a fresh project.

Reproduction steps:

  1. Create a new Expo project
  2. Add graphql-tools package to project
  3. Try to import from it (e.g. import { makeExecutableSchema } from 'graphql-tools';)

Versions:

  • Expo 25.0.0
  • graphql-tools 2.19.0 (also tested previous version, 2.18.0)

Any advice? This should work, right? Thanks.

It dawned on me that this is likely not an Expo issue, but a React Native one. I just tested in a vanilla RN project and got the same result, so feel free to disregard. :slightly_frowning_face:

1 Like

@wkovacs64 it’s probably an issue with graphql-tools. Maybe open an issue there? Thanks for debugging.

For anyone who happens to find themselves here from Google or whatever, the solution was to install the graphql-subscriptions and events downstream dependencies explicitly. As I suspected, not an Expo issue. Sorry for the pollution.

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