Unable to start Strapi after installing GraphQL

Hi Team,
I just installed strapi today and created a simple hello world content-type, now i am trying to install graphql but as soon as i install it, strapi stopped working. and I am getting below error.

Strapi Version: 4.16.2
Installation via : npm
node version : v20.9.0

I tried searching on the google / stackoverflow and forums too, but no luck.

already tried, deleting node_modules and package.lock file, npm dedupe command, resolutions object in package.json file, almost everything but no luck

Please help

error message

[2023-12-23 11:45:45.764] debug: ⛔️ Server wasn't able to start properly.
[2023-12-23 11:45:45.765] error: Cannot use GraphQLScalarType "Time" 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.
Error: Cannot use GraphQLScalarType "Time" 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 (/Users/manishbansal/code/algocommerce/node_modules/graphql/jsutils/instanceOf.js:43:19)
    at isScalarType (/Users/manishbansal/code/algocommerce/node_modules/graphql/type/definition.js:117:37)
    at isNamedType (/Users/manishbansal/code/algocommerce/node_modules/graphql/type/definition.js:464:5)
    at SchemaBuilder.addTypes (/Users/manishbansal/code/algocommerce/node_modules/nexus/dist/builder.js:270:39)
    at /Users/manishbansal/code/algocommerce/node_modules/nexus/dist/builder.js:281:54
    at Array.forEach (<anonymous>)
    at SchemaBuilder.addTypes (/Users/manishbansal/code/algocommerce/node_modules/nexus/dist/builder.js:281:32)
    at /Users/manishbansal/code/algocommerce/node_modules/nexus/dist/builder.js:278:45
    at Array.forEach (<anonymous>)
    at SchemaBuilder.addTypes (/Users/manishbansal/code/algocommerce/node_modules/nexus/dist/builder.js:278:19)
manishbansal@Manishs-MacBook-Pro algocommerce % 

See Graphql plugin duplication · Issue #15102 · strapi/strapi · GitHub
I had to delete the node_moduls folder and run npm i again.

1 Like

I tried to replicate the issue, and it worked fine. After reinstalling your node modules, did it fix it.