Strapi + GraphQL error

System Information
  • Strapi Version: 3.6.8
  • Operating System: MacOS
  • Database: MongoDB
  • Node Version: v16.7.0
  • NPM Version: 7.24.1
  • Yarn Version: /

Hi, I am trying to explore Strapi using GraphQL. However, a clean installation of Strapi + GraphQL always seems to result in the following error:

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.

Running npm list graphql results in

└─┬ strapi-plugin-graphql@3.6.8
  ├─┬ @apollo/federation@0.20.7
  │ ├─┬ apollo-graphql@0.6.1
  │ │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ └── graphql@14.7.0 invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  ├─┬ @graphql-tools/utils@7.2.4
  │ └── graphql@14.7.0 deduped
  ├─┬ apollo-server-koa@2.24.0
  │ ├─┬ apollo-server-core@2.25.2
  │ │ ├─┬ @apollographql/graphql-upload-8-fork@8.1.3
  │ │ │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ │ ├─┬ apollo-cache-control@0.14.0
  │ │ │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ │ ├─┬ apollo-graphql@0.9.3
  │ │ │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ │ ├─┬ apollo-server-errors@2.5.0
  │ │ │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ │ ├─┬ apollo-server-plugin-base@0.13.0
  │ │ │ ├─┬ apollo-server-types@0.9.0
  │ │ │ │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ │ │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ │ ├─┬ apollo-server-types@0.9.0
  │ │ │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ │ ├─┬ apollo-tracing@0.15.0
  │ │ │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ │ ├─┬ graphql-extensions@0.15.0
  │ │ │ ├─┬ apollo-server-types@0.9.0
  │ │ │ │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ │ │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ │ ├─┬ graphql-tag@2.12.5
  │ │ │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ │ ├── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ │ └─┬ subscriptions-transport-ws@0.9.19
  │ │   └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ ├─┬ apollo-server-types@0.8.0
  │ │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ ├─┬ graphql-subscriptions@1.2.1
  │ │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ └── graphql@14.7.0 deduped
  ├─┬ graphql-depth-limit@1.1.0
  │ └── graphql@14.7.0 deduped
  ├─┬ graphql-iso-date@3.6.1
  │ └── graphql@14.7.0 deduped
  ├─┬ graphql-tools@4.0.8
  │ ├─┬ apollo-link@1.2.14
  │ │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ ├─┬ apollo-utilities@1.3.4
  │ │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  │ └── graphql@14.7.0 deduped
  ├─┬ graphql-type-json@0.3.2
  │ └── graphql@14.7.0 deduped
  ├─┬ graphql-type-long@0.1.1
  │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  ├─┬ graphql-upload@11.0.0
  │ └── graphql@14.7.0 deduped invalid: "^0.9.1 || ^0.10.0 || ^0.12.0 || ^0.13.0" from node_modules/graphql-type-long
  └── graphql@15.5.0

So I guess the problem is that globally graphql@15.5.0 is installed while the packages need graphql@14.7.0. As I am not an experienced developer I really have no idea how to fix this…

I had the same issue and fixed it with the following:

-delete node_modules
-npm install
-npm dedupe