Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playground with facebooks create-react-app fails to compile #747

Open
1 of 7 tasks
gpotzkov opened this issue Jun 22, 2018 · 5 comments
Open
1 of 7 tasks

Playground with facebooks create-react-app fails to compile #747

gpotzkov opened this issue Jun 22, 2018 · 5 comments

Comments

@gpotzkov
Copy link

This issue pertains to the following package(s):

  • GraphQL Playground - Electron App
  • GraphQL Playground HTML
  • GraphQL Playground
  • GraphQL Playground Express Middleware
  • GraphQL Playground Hapi Middleware
  • GraphQL Playground Koa Middleware
  • GraphQL Playground Lambda Middleware

What OS and OS version are you experiencing the issue(s) on?

OSX

What version of graphql-playground(-electron/-middleware) are you experiencing the issue(s) on?

"graphql-playground-react": "^1.7.0",

What is the expected behavior?

Working local playground react client

What is the actual behavior?

Module not found: Can't resolve 'graphql/validation/rules/ExecutableDefinitions'
graphql/graphql-language-service#239

What steps may we take to reproduce the behavior?

Create react app with https://github.com/facebook/create-react-app and follow your own Playground React instructions

Please provide a gif or image of the issue for a quicker response/fix.
client____documents_workspace_emundo_crepo-graphql_client__-____package_json__client

@mikkmartin
Copy link

mikkmartin commented Jul 18, 2018

having the same problem bootstrapping with next.js

@TravisBernard
Copy link

This is related to what seems to be an accidental BC break in the Graphql library. Followed the instructions in this issue over on the graphiql project, namely yarn add graphql@0.13.2 and ignore the dependency warnings and it fixed for me.

@tizmagik
Copy link

I just hit this today with a fresh create-react-app --typescript app:

"dependencies": {
    "graphql-playground-react": "^1.7.20",
    "react": "^16.12.0",
    "react-dom": "^16.12.0",
    "react-redux": "^7.1.3",
    "react-scripts": "3.2.0",
    "typescript": "3.7.2"
  },
import React from "react";
import { Provider } from "react-redux";
import { Playground, store } from "graphql-playground-react";

const App: React.FC = () => (
  <Provider store={store}>
    <Playground endpoint="https://api.graph.cool/simple/v1/swapi" />
  </Provider>
);

@tizmagik
Copy link

If you npm i graphql as a direct dependency (which pulled down graphql@14.5.8 as of this writing) it gets you around the error and the app seems to work. However, the following console error appears when running the app:

Uncaught Error: Cannot use GraphQLSchema "[object Object]" 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.
    at instanceOf (:3000/static/js/0.chunk.js:84859)
    at isSchema (:3000/static/js/0.chunk.js:91596)
    at assertSchema (:3000/static/js/0.chunk.js:91599)
    at validateSchema (:3000/static/js/0.chunk.js:91914)
    at assertValidSchema (:3000/static/js/0.chunk.js:91937)
    at validate (:3000/static/js/0.chunk.js:100267)
    at validateWithCustomRules (:3000/static/js/0.chunk.js:47626)
    at validateQuery (:3000/static/js/0.chunk.js:46011)
    at getDiagnostics (:3000/static/js/0.chunk.js:45999)
    at :3000/static/js/0.chunk.js:6039
    at startLinting (:3000/static/js/0.chunk.js:9937)
    at :3000/static/js/0.chunk.js:9985

@andywangsk
Copy link

andywangsk commented Dec 18, 2019

Had the same issue @tizmagik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants