Error: Cannot use GraphQLScalarType "BigDecimal" from another module or realm.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.5k
- Forks
- 5.4k
- PR merge metrics
- No merged PRs in 30d
Description
Bug Description
yarn prestart
yarn run v1.22.5
$ yarn graphql:generate && yarn prei18n:extract
$ graphql-codegen --config codegen.yml
√ Parse configuration
> Generate outputs
> Generate ./src/state/data/generated.ts
√ Load GraphQL schemas
√ Load GraphQL documents
× Generate
→ spurious results.
Found 1 error
× ./src/state/data/generated.ts
Error: Cannot use GraphQLScalarType "BigDecimal" 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 (D:\docs\repos\uniswap\node_modules\graphql\jsutils\instanceOf.js:35:13)
at isScalarType (D:\docs\repos\uniswap\node_modules\graphql\type\definition.js:109:34)
at printType (D:\docs\repos\uniswap\node_modules\graphql\utilities\printSchema.js:126:36)
at D:\docs\repos\uniswap\node_modules\graphql\utilities\printSchema.js:59:12
at Array.map (<anonymous>)
at printFilteredSchema (D:\docs\repos\uniswap\node_modules\graphql\utilities\printSchema.js:58:13)
at Object.printSchema (D:\docs\repos\uniswap\node_modules\graphql\utilities\printSchema.js:40:10)
at transformSchemaAST (D:\docs\repos\uniswap\node_modules\@graphql-codegen\typescript\index.cjs.js:327:35)
at Object.plugin (D:\docs\repos\uniswap\node_modules\@graphql-codegen\typescript\index.cjs.js:345:38)
at executePlugin (D:\Docs\repos\uniswap\node_modules\@graphql-codegen\core\index.cjs.js:38:35)
Error: Cannot use GraphQLScalarType "BigDecimal" 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 (D:\docs\repos\uniswap\node_modules\graphql\jsutils\instanceOf.js:35:13)
at isScalarType (D:\docs\repos\uniswap\node_modules\graphql\type\definition.js:109:34)
at printType (D:\docs\repos\uniswap\node_modules\graphql\utilities\printSchema.js:126:36)
at D:\docs\repos\uniswap\node_modules\graphql\utilities\printSchema.js:59:12
at Array.map (<anonymous>)
at printFilteredSchema (D:\docs\repos\uniswap\node_modules\graphql\utilities\printSchema.js:58:13)
at Object.printSchema (D:\docs\repos\uniswap\node_modules\graphql\utilities\printSchema.js:40:10)
at transformSchemaAST (D:\docs\repos\uniswap\node_modules\@graphql-codegen\typescript\index.cjs.js:327:35)
at Object.plugin (D:\docs\repos\uniswap\node_modules\@graphql-codegen\typescript\index.cjs.js:345:38)
at executePlugin (D:\Docs\repos\uniswap\node_modules\@graphql-codegen\core\index.cjs.js:38:35)
Something went wrong
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Steps to Reproduce
- yarn
- yarn prestart
Expected Behavior
GraphQL Code Generator should complete successfully.
Additional Context
even adding graphql resolutions won't fix this in yarn.
There are no bootstrap docs in the readme. its more like an about page.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with codegen.yml and the generated output at src/state/data/generated.ts, then run yarn and yarn prestart to reproduce the GraphQL Code Generator failure. Inspect how multiple graphql modules or versions are loaded, using the reported BigDecimal error as the constraint. Done means GraphQL code generation completes successfully and prestart proceeds without this error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100