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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with yarn pnp #7999

Closed
Shayan-To opened this issue Apr 23, 2022 · 7 comments
Closed

Issues with yarn pnp #7999

Shayan-To opened this issue Apr 23, 2022 · 7 comments
Labels
Stale Inactive issues

Comments

@Shayan-To
Copy link

馃悰 bug report

I'm trying to use yarn 3 with pnp linker, and I have been experiencing many problems.

Until yesterday, an empty parcel project wouldn't run. It was reported in #7976. Version 2.5.0 fixed that.

Now I'm having problems with a nearly empty .parcelrc file.

馃帥 Configuration (.babelrc, package.json, cli command)

I'm creating an empty project with these commands:

corepack prepare --activate yarn@3.2.0 # setting global yarn version
yarn init
yarn add -D parcel
echo '<body>Hello</body>' > index.html
echo '{ "extends": "@parcel/config-default" }' > .parcelrc

And running the project with yarn parcel index.html.

馃 Expected Behavior

Project should run.

馃槸 Current Behavior

It's giving me this error:

@parcel/core: Cannot find extended parcel config

/home/shayan/Coding/yarn-parcel-2/.parcelrc:2:16
  1 | {
> 2 |     "extends": "@parcel/config-default"
>   |                ^^^^^^^^^^^^^^^^^^^^^^^^ Cannot find module "@parcel/config-default"
  3 | }
  4 | 

I tried yarn add -D @parcel/config-default, and the error changes to this:

Server running at http://localhost:1234
馃毃 Build failed.

@parcel/transformer-js: Could not resolve module "@parcel/core" from
"/home/shayan/Coding/yarn-parcel-2/.yarn/__virtual__/@parcel-workers-virtual-01f64d21dc/0/cache/@parcel-workers-npm-2.5.0-716cc1acfd-82a1cf1c56.zip/node_modules/@parcel/workers/lib/Handle.js"

  Error: Could not resolve module "@parcel/core" from
  "/home/shayan/Coding/yarn-parcel-2/.yarn/__virtual__/@parcel-workers-virtual-01f64d21dc/0/cache/@parcel-workers-npm-2.5.0-716cc1acfd-82a1cf1c56.zip/node_modules/@parcel/workers/lib/Handle.js"
  at $0578d0f6e116167e$export$fb2a0b866a8162dc.resolve
  (/home/shayan/Coding/yarn-parcel-2/.yarn/__virtual__/@parcel-package-manager-virtual-5853e6c739/0/cache/@parcel-package-manager-npm-2.5.0-451e73037f-d1b307d19c.zip/node_modules/@parcel/package-manager/lib/index.js:5013:21)
  at NodePackageManager.resolveSync
  (/home/shayan/Coding/yarn-parcel-2/.yarn/__virtual__/@parcel-package-manager-virtual-5853e6c739/0/cache/@parcel-package-manager-npm-2.5.0-451e73037f-d1b307d19c.zip/node_modules/@parcel/package-manager/lib/index.js:3512:42)
  at NodePackageManager.requireSync
  (/home/shayan/Coding/yarn-parcel-2/.yarn/__virtual__/@parcel-package-manager-virtual-5853e6c739/0/cache/@parcel-package-manager-npm-2.5.0-451e73037f-d1b307d19c.zip/node_modules/@parcel/package-manager/lib/index.js:3353:34)
  at Module.m.require
  (/home/shayan/Coding/yarn-parcel-2/.yarn/__virtual__/@parcel-package-manager-virtual-5853e6c739/0/cache/@parcel-package-manager-npm-2.5.0-451e73037f-d1b307d19c.zip/node_modules/@parcel/package-manager/lib/index.js:3367:25)
  at require (node:internal/modules/cjs/helpers:102:18)
  at _core
  (/home/shayan/Coding/yarn-parcel-2/.yarn/__virtual__/@parcel-workers-virtual-01f64d21dc/0/cache/@parcel-workers-npm-2.5.0-716cc1acfd-82a1cf1c56.zip/node_modules/@parcel/workers/lib/Handle.js:9:16)
  at Object.<anonymous>
  (/home/shayan/Coding/yarn-parcel-2/.yarn/__virtual__/@parcel-workers-virtual-01f64d21dc/0/cache/@parcel-workers-npm-2.5.0-716cc1acfd-82a1cf1c56.zip/node_modules/@parcel/workers/lib/Handle.js:57:5)
  at Module._compile (node:internal/modules/cjs/loader:1103:14)
  at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
  at Object.require$$0.Module._extensions..js (/home/shayan/Coding/yarn-parcel-2/.pnp.cjs:11601:33)

Then I tried yarn add -D @parcel/core, and the error changed to this:

Server running at http://localhost:1234
馃毃 Build failed.

@parcel/package-manager: Could not find module "@parcel/resolver-default", but it was listed in package.json. Run your package manager first.

  /home/shayan/Coding/yarn-parcel-2/.yarn/__virtual__/@parcel-config-default-virtual-61f3e0dfd8/0/cache/@parcel-config-default-npm-2.5.0-5950a06512-9568f6ac25.zip/node_modules/@parcel/config-default/package.json:35:5
    34 |     "@parcel/reporter-dev-server": "2.5.0",
  > 35 |     "@parcel/resolver-default": "2.5.0",
  >    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ Defined here, but not installed
    36 |     "@parcel/runtime-browser-hmr": "2.5.0",
    37 |     "@parcel/runtime-js": "2.5.0",

馃實 Your Environment

Software Version(s)
Parcel 2.5.0
Node v16.14.2
Yarn 3.2.0
Operating System Ubuntu 20.04.4 LTS
@mischnic
Copy link
Member

@parcel/transformer-js: Could not resolve module "@parcel/core" from

Strange, that should have been fixed by #7977

@Shayan-To
Copy link
Author

@parcel/transformer-js: Could not resolve module "@parcel/core" from

Strange, that should have been fixed by #7977

It was fixed, until I added a .parcelrc file.

@arcanis
Copy link
Contributor

arcanis commented Apr 25, 2022

Sharing my findings:

our E2E test does: {"extends": "@parcel/config-default"}, and @parcel/config-default has a peer dependency on @parcel/core which is not fulfilled, because the main package is parcel; in nm it works because of the accidental hoisting

I'm not sure what would be the proper fix ... perhaps make @parcel/core an optional peer dep with fallback of parcel; this way, people would be able to manually add it to their deps to fulfil the @parcel/config-default peer dep while still sharing the instance with parcel itself (and since it'd be optional it wouldn't print a warning if missing when unneeded).

the alternative would be to make @parcel/core part of parcel, so that everything could peer-depend on the package users actually add in their deps (ie parcel), but that requires more work on your side

@mischnic
Copy link
Member

mischnic commented Apr 25, 2022

perhaps make @parcel/core an optional peer dep with fallback of parcel

Unless we can somehow get rid of the peerdependencies entirely, I think this is the best solution.

@LekoArts
Copy link
Contributor

I'm trying to update Gatsby to Parcel 2.5.0 in gatsbyjs/gatsby#35446 and I'm also hitting failures in our PnP test suite: https://app.circleci.com/pipelines/github/gatsbyjs/gatsby/81867/workflows/d3e36eec-2a63-4525-95b5-d8db5758292f/jobs/971306

error Error: /tmp/e2e-tests/gatsby-pnp/.yarn/__virtual__/gatsby-parcel-config-virtual-a1c7aa3859/4/home/circleci/project/node_modules/@parcel/source-map/parcel_sourcemap_node/artifacts/index.linux-x64-gnu.node: cannot open shared object file: No such file or directory
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1122:18)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at NodePackageManager.load (/tmp/e2e-tests/gatsby-pnp/.yarn/__virtual__/@parcel-package-manager-virtual-5853e6c739/0/cache/@parcel-package-manager-npm-2.5.0-451e73037f-d1b307d19c.zip/packages/core/package-manager/src/NodePackageManager.js:130:9)
    at NodePackageManager.requireSync (/tmp/e2e-tests/gatsby-pnp/.yarn/__virtual__/@parcel-package-manager-virtual-5853e6c739/0/cache/@parcel-package-manager-npm-2.5.0-451e73037f-d1b307d19c.zip/packages/core/package-manager/src/NodePackageManager.js:94:17)
    at Module.m.require (/tmp/e2e-tests/gatsby-pnp/.yarn/__virtual__/@parcel-package-manager-virtual-5853e6c739/0/cache/@parcel-package-manager-npm-2.5.0-451e73037f-d1b307d19c.zip/packages/core/package-manager/src/NodePackageManager.js:117:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/tmp/e2e-tests/gatsby-pnp/.yarn/__virtual__/gatsby-parcel-config-virtual-a1c7aa3859/4/home/circleci/project/node_modules/@parcel/source-map/parcel_sourcemap_node/index.js:15:18)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Object.require$$0.Module._extensions..js (/tmp/e2e-tests/gatsby-pnp/.pnp.cjs:28565:33)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at NodePackageManager.load (/tmp/e2e-tests/gatsby-pnp/.yarn/__virtual__/@parcel-package-manager-virtual-5853e6c739/0/cache/@parcel-package-manager-npm-2.5.0-451e73037f-d1b307d19c.zip/packages/core/package-manager/src/NodePackageManager.js:130:9)
    at NodePackageManager.requireSync (/tmp/e2e-tests/gatsby-pnp/.yarn/__virtual__/@parcel-package-manager-virtual-5853e6c739/0/cache/@parcel-package-manager-npm-2.5.0-451e73037f-d1b307d19c.zip/packages/core/package-manager/src/NodePackageManager.js:94:17)
    at Module.m.require (/tmp/e2e-tests/gatsby-pnp/.yarn/__virtual__/@parcel-package-manager-virtual-5853e6c739/0/cache/@parcel-package-manager-npm-2.5.0-451e73037f-d1b307d19c.zip/packages/core/package-manager/src/NodePackageManager.js:117:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/tmp/e2e-tests/gatsby-pnp/.yarn/__virtual__/gatsby-parcel-config-virtual-a1c7aa3859/4/home/circleci/project/node_modules/@parcel/source-map/dist/node.js:14:18)

We're currently on 2.3.2 and also saw this for the update to 2.4.x: gatsbyjs/gatsby#35307

Any idea if that might be related or something completely unrelated?

@LekoArts
Copy link
Contributor

LekoArts commented May 9, 2022

I opened a bug report for my issue now on the yarn repository: yarnpkg/berry#4443

@github-actions
Copy link

github-actions bot commented Nov 5, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.

@github-actions github-actions bot added the Stale Inactive issues label Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Inactive issues
Projects
None yet
Development

No branches or pull requests

4 participants