question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Version 1.18.3 : Ensure that there is only one instance of "graphql" in the node_modules directory.

See original GitHub issue

Anyone getting this error below for using “graphql-yoga”: “^1.18.3” in your package.json. I have nothing else but only graphql-yoga in my dependencies but the server isn’t running. The error message:

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.

Code:

// index.js
const { GraphQLServer } = require('graphql-yoga')

const typeDefs = `
  type Query {
    hello(name: String): String!
  }
`

const resolvers = {
  Query: {
    hello: (_, { name }) => `Hello ${name || 'World'}`,
  },
}

const server = new GraphQLServer({ typeDefs, resolvers })
server.start(() => console.log('Server is running on localhost:4000'))

Any ideas how to get this fixed?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

4reactions
qgar12commented, Nov 5, 2020

Fix works on my side:

  • add resolutions field in package.json

  • use yarn install

4reactions
WangShuXian6commented, May 14, 2020

Add a resolutions field to your package.json file and define your version overrides:

 "resolutions":{
    "graphql": "^15.0.0"
  }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: "Ensure there is only one instance of GraphQL ... - GitHub
If different versions of "graphql" are the dependencies of other\nrelied on modules, use "resolutions" to ensure only one version is installed.\ ...
Read more >
reactjs - Ensure that there is only one instance of "graphql" in ...
Ensure that there is only one instance of "graphql" in the node_modules directory. If different versions of "graphql" are the dependencies of other...
Read more >
How to fix the annoying "Ensure there is only one instance of ...
Ensure that there is only one instance of "graphql" in the node_modules directory. I personally tend to hit it in the worst possible...
Read more >
type-graphql/Lobby - Gitter
I am trying to use custom scalar but schema builder throws an error. ... Ensure that there is only one instance of "graphql"...
Read more >
How to Launch Your MVP Server in an Hour - Medium
Many alternatives use Prisma to convert a GraphQL schema to an underlying database. Make sure to check out GraphCool. As of this writing,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found