Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm link with graphql package breaks application #4113

Closed
chdanielmueller opened this issue Jun 18, 2024 · 2 comments
Closed

npm link with graphql package breaks application #4113

chdanielmueller opened this issue Jun 18, 2024 · 2 comments

Comments

@chdanielmueller
Copy link

Hi there,

I get an error while developing a package which adds functionality to graphql.
My issue is the check to verify that only one instance of graphql is in use.
If I npm link my package to my graphql server it does no longer run since the error gets thrown.
npm link does (as far as I understand) also use the node_modules of my linked package.
Which results in another instance of graphql which I want in this specific case.

The error in question:

Cannot use ${className} "${stringifiedValue}" 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.

Source of the error:
https://github.com/graphql/graphql-js/blob/main/src/jsutils/instanceOf.ts

I was wondering if an environment variable which circumvents this exception would be something that can be considered.
I am opening a PR with the change.

Thanks,
Daniel

@JoviDeCroock
Copy link
Contributor

Duplicate of #3713

@chdanielmueller
Copy link
Author

@JoviDeCroock Thanks. I need to level up my search skills 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants