'Strapi error Error: Cannot use GraphQLObjectType "Query" from another module or realm

whenever i try to install graphql from strapi marketplace, i run into this problem

error Error: Cannot use GraphQLObjectType "Query" 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.


Solution 1:[1]

Do some following steps by get rid of this issue!

  • Remove package-lock.json and purged node_modules
  • Downgrade NPM version to v 6.14.15
  • Try to run npm run strapi uninstall graphql and then npm run strapi install graphql.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Abdul Moeez