Version 1.18.3 : Ensure that there is only one instance of "graphql" in the node_modules directory.
See original GitHub issueAnyone 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:
- Created 3 years ago
- Reactions:4
- Comments:6
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fix works on my side:
add resolutions field in package.json
use yarn install