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

Yarn 2.0 support #2923

Open
snikch opened this issue Oct 7, 2021 · 5 comments
Open

Yarn 2.0 support #2923

snikch opened this issue Oct 7, 2021 · 5 comments
Labels
stage/0-issue-prerequisites Needs more information before we can start working on it

Comments

@snikch
Copy link

snikch commented Oct 7, 2021

Describe the bug

GraphQL Mesh does not appear to have correctly defined dependencies in its packages, and as such will not run out of the box with Yarn 2.0+. Some of the issues come from upstream packages, but some are also @graphql-mesh packages.

To Reproduce
Steps to reproduce the behavior:

> yarn init
yarn init v1.22.11
question name (mesh2):
question version (1.0.0):
question description:
question entry point (index.js):
question repository url:
question author:
question license (MIT):
question private:
success Saved package.json
✨  Done in 2.56s.

> yarn set version berry
Resolving berry to a url...
Downloading https://github.com/yarnpkg/berry/raw/master/packages/berry-cli/bin/berry.js...
Saving it into /Users/mal/Code/src/gitlab.inmusicbrands.com/cloud/mesh2/.yarn/releases/yarn-berry.cjs...
Updating /Users/mal/Code/src/gitlab.inmusicbrands.com/cloud/mesh2/.yarnrc.yml...
Done!

> yarn add @graphql-mesh/cli
➤ YN0000: ┌ Resolution step
➤ YN0002: │ @graphql-mesh/cli@npm:0.41.0 [b4b5a] doesn't provide graphql-tag (p5841b), requested by @graphql-codegen/typescript-generic-sdk
➤ YN0002: │ mesh2@workspace:. doesn't provide graphql (p19ff9), requested by @graphql-mesh/cli
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 7s 805ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ yargs-parser@npm:18.1.3 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs-parser@npm:20.2.9 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs@npm:15.4.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs@npm:17.2.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yocto-queue@npm:0.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 3s 489ms
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed in 0s 411ms
➤ YN0000: Done with warnings in 11s 785ms
yarn add @graphql-mesh/cli  10.25s user 2.24s system 86% cpu 14.507 total

> yarn run mesh dev
/Users/mal/Code/src/gitlab.inmusicbrands.com/cloud/mesh2/.pnp.cjs:14675
    throw firstError;
    ^

Error: @graphql-tools/utils tried to access graphql (a peer dependency) but it isn't provided by your application; this makes the require call ambiguous and unsound.

Required package: graphql
Required by: @graphql-tools/utils@virtual:d76146c6a6cf1026eae6a659b42ea73a5ac6ef5c4ab43e1d1c3836adaf2d4c8c39297d580f36f1574a206fb01b2810a246ddde8ccdde86f74d9a1c9c0ae22e9c#npm:8.2.5 (via /Users/mal/Code/src/gitlab.inmusicbrands.com/cloud/mesh2/.yarn/__virtual__/@graphql-tools-utils-virtual-5edbf7bf35/0/cache/@graphql-tools-utils-npm-8.2.5-2667229970-421147485c.zip/node_modules/@graphql-tools/utils/)
Ancestor breaking the chain: mesh2@workspace:.


Require stack:
- /Users/mal/Code/src/gitlab.inmusicbrands.com/cloud/mesh2/.yarn/__virtual__/@graphql-tools-utils-virtual-5edbf7bf35/0/cache/@graphql-tools-utils-npm-8.2.5-2667229970-421147485c.zip/node_modules/@graphql-tools/utils/index.js
- /Users/mal/Code/src/gitlab.inmusicbrands.com/cloud/mesh2/.yarn/__virtual__/@graphql-mesh-utils-virtual-2a9b48df9a/0/cache/@graphql-mesh-utils-npm-0.17.2-3892945af8-bdc94b382e.zip/node_modules/@graphql-mesh/utils/index.js
- /Users/mal/Code/src/gitlab.inmusicbrands.com/cloud/mesh2/.yarn/__virtual__/@graphql-mesh-cli-virtual-d76146c6a6/0/cache/@graphql-mesh-cli-npm-0.41.0-e52b17b839-1913166ec6.zip/node_modules/@graphql-mesh/cli/bin.js
    at Function.external_module_.Module._resolveFilename (/Users/mal/Code/src/gitlab.inmusicbrands.com/cloud/mesh2/.pnp.cjs:14674:55)
    at Function.external_module_.Module._load (/Users/mal/Code/src/gitlab.inmusicbrands.com/cloud/mesh2/.pnp.cjs:14473:48)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (/Users/mal/Code/src/gitlab.inmusicbrands.com/cloud/mesh2/.yarn/__virtual__/@graphql-tools-utils-virtual-5edbf7bf35/0/cache/@graphql-tools-utils-npm-8.2.5-2667229970-421147485c.zip/node_modules/@graphql-tools/utils/index.js:5:17)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.external_module_.Module._load (/Users/mal/Code/src/gitlab.inmusicbrands.com/cloud/mesh2/.pnp.cjs:14523:14)
    at Module.require (node:internal/modules/cjs/loader:1005:19)

This can be manually worked around by adding the following to .yarnrc.yml.

packageExtensions:
  "@graphql-tools/utils@8.2.5":
    dependencies:
      graphql: "*"
  "@graphql-mesh/cli@0.41.0":
    dependencies:
      "@graphql-mesh/types": "*"
      "@graphql-mesh/cache-inmemory-lru": "*"
  "@graphql-mesh/utils@0.17.2":
    dependencies:
      graphql: "*"

Environment:

  • OS: Mac
  • @graphql-mesh/cli: 0.41.0
  • NodeJS: v16.8.0

Additional context

@ardatan
Copy link
Owner

ardatan commented Dec 28, 2021

Do you have graphql package installed in your project?

@ardatan ardatan added the waiting-for-answer Waiting for answer from author label Dec 28, 2021
@tamacti
Copy link

tamacti commented Jan 6, 2022

I have the same issue.

$ yarn mesh dev
~/my-project/.pnp.cjs:26238
throw firstError;
    ^

Error: @graphql-mesh/cli tried to access @graphql-mesh/types, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: @graphql-mesh/types
Required by: @graphql-mesh/cli@virtual:5696cc1addee22c455c87f56d44478f4b95fd689d8455b88c642a128b6a6bb307ed2876bdee9944574c8e0b61cc4cddc3daf3a4ea899ca0365edb0f54870e82c#npm:0.45.0 (via ~/my-project/.yarn/__virtual__/@graphql-mesh-cli-virtual-66fea35a1d/0/cache/@graphql-mesh-cli-npm-0.45.0-044085497b-63641f552c.zip/node_modules/@graphql-mesh/cli/)

Then I tried to add the package mentioned above:

➤ YN0000: ┌ Resolution step
➤ YN0002: │ @endemolshinegroup/cosmiconfig-typescript-loader@npm:3.0.2 [fd1fb] doesn't provide typescript (p51d8a), requested by ts-node
➤ YN0002: │ @graphql-mesh/cli@npm:0.45.0 [957eb] doesn't provide graphql-jit (paa5ba), requested by @graphql-codegen/typescript-jit-sdk
➤ YN0002: │ @graphql-mesh/cli@npm:0.45.0 [957eb] doesn't provide graphql-tag (pa72d2), requested by @graphql-codegen/typescript-jit-sdk
➤ YN0060: │ @my-project/schema@workspace:packages/schema provides graphql (p49a81) with version 16.2.0, which doesn't satisfy what @graphql-codegen/typescript-resolvers and some of its descendants request
➤ YN0060: │ @my-project/server@workspace:packages/server provides graphql (pa98f0) with version 16.2.0, which doesn't satisfy what @graphql-mesh/cli and some of its descendants request
➤ YN0060: │ @my-project/server@workspace:packages/server provides graphql (pc30c6) with version 16.2.0, which doesn't satisfy what apollo-server-core and some of its descendants request
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 0s 388ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0000: └ Completed
➤ YN0000: Done with warnings in 0s 892ms

And tried again:

$ yarn packages/server mesh dev
~/my-project/.pnp.cjs:24936
    throw firstError;
    ^

Error: @graphql-mesh/cli tried to access @graphql-mesh/types, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: @graphql-mesh/types
Required by: @graphql-mesh/cli@virtual:957ebe0bb439cda0610c18e00060d3a56bcfa29f074da0ba599e90494e26c64af27f7863017f4141a3cea89009ee32ac6c94b1b41db9137ab0cb3f54b05b5b1b#npm:0.45.0 (via ~/my-project/.yarn/__virtual__/@graphql-mesh-cli-virtual-dc675481bf/0/cache/@graphql-mesh-cli-npm-0.45.0-044085497b-63641f552c.zip/node_modules/@graphql-mesh/cli/)

My env:

$ node -v
v17.3.0

$ yarn -v
3.1.1

package.json:

"devDependencies": {
    "@graphql-mesh/cache-inmemory-lru": "0.5.37",
    "@graphql-mesh/cli": "0.45.0",
    "@graphql-mesh/openapi": "0.23.1",
    "@graphql-mesh/types": "0.57.1",
    "@graphql-mesh/utils": "0.24.2",
    "graphql": "16.2.0"
  }

@ardatan ardatan removed the waiting-for-answer Waiting for answer from author label Jul 20, 2022
@Urigo Urigo mentioned this issue Aug 11, 2022
3 tasks
@theguild-bot theguild-bot mentioned this issue Nov 15, 2022
@theguild-bot theguild-bot mentioned this issue Sep 28, 2023
@tdsfugal
Copy link

tdsfugal commented Nov 26, 2023

Same problem. This works:

in package.json:

  "packageManager": "yarn@4.0.2",
  "dependencies": {
    "@graphql-mesh/cli": "^0.88.1",
    "@graphql-mesh/graphql": "^0.96.0",
    "graphql": "^16.8.1"
  }

in .yarnrc.yaml

yarnPath: .yarn/releases/yarn-4.0.2.cjs
nodeLinker: "pnp"
packageExtensions:
  "@graphql-mesh/cli@^0.88.1":
    dependencies:
      "@types/node": "*"
      "graphql-tag": "*"
  "@graphql-mesh/config@^0.98.1":
    dependencies:
      "graphql-yoga": "^5.0.0"
  "@graphql-mesh/merger-bare@^0.96.0":
    dependencies:
      "@graphql-mesh/store": "^0.96.0"
      "@graphql-mesh/cross-helpers": "^0.4.1"
  "@graphql-mesh/graphql@^0.96.0":
    dependencies:
      "@graphql-mesh/cross-helpers": "*"
      "@graphql-mesh/store": "^0.96.0"
      "@graphql-mesh/types": "^0.96.0"
      "@graphql-mesh/utils": "^0.96.0"
      "@graphql-tools/utils": "^9.2.1"
      "tslib": "^2.4.0"

@Urigo
Copy link
Collaborator

Urigo commented Dec 2, 2023

Thanks for the reports!

Can someone create a simple reproduction?

Sorry but I'm not adding a lot here but just labeling it according to our new Contribution Guide and issue flow.

It seems already got into stage 0.

Now in order to advance to stage 1 we'll need a simple reproduction, maybe in code-sandbox?

Later to progress to stage 2, a failing test would be needed, would be great if someone could help progress the issues through the stages.

Thank you and sorry that this comment is not a complete solution (yet).

@Urigo Urigo added the stage/0-issue-prerequisites Needs more information before we can start working on it label Dec 2, 2023
@robigan
Copy link

robigan commented Feb 29, 2024

+1

Yarn 1.x versions (which supports node_modules) is in EOL maintenance. With Corepack since Node 18 there's been a large push to use plug and play, which is what yarn 2.x >= uses. PNP is much more explicity with its dependencies, so it would be nice to see this advance and garner native support from the main maintainers.

This was referenced Apr 30, 2024
This was referenced May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage/0-issue-prerequisites Needs more information before we can start working on it
Projects
None yet
Development

No branches or pull requests

6 participants