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

Parcel v2 invokes yarn on a pnpm repo and spews errors #5950

Open
leaumar opened this issue Mar 2, 2021 · 9 comments
Open

Parcel v2 invokes yarn on a pnpm repo and spews errors #5950

leaumar opened this issue Mar 2, 2021 · 9 comments

Comments

@leaumar
Copy link

leaumar commented Mar 2, 2021

🐛 bug report

Parcel v2 seems to want to install extra dependencies during compilation, but uses yarn to do this while my repo is pnpm and has no trace of yarn.

🎛 Configuration (.babelrc, package.json, cli command)

Fairly small repo, please check any config you need to see: https://gitlab.com/Marnes/public-ip-display/-/tree/parcel2

I don't think any particular configuration is relevant to copy here since the issue is with package managers.

🤔 Expected Behavior

If parcel wants to install extra dependencies automagically, it should detect the package manager with certainty or fail, not just invoke a wrong one. If no supported manager is detected, it should output informative messages telling the user what it wanted to do automagically so it can be done manually (i.e. which dependencies does it need). This is separate from what's asked in #3408.

😯 Current Behavior

pnpm compile or parcel build src/*.* src/images/flags/* src/images/error-* --dist-dir extension

console output
yarn-error.log

Console output breakdown:

  • a hundred repetitions of

@parcel/cache: EPERM: operation not permitted, rename 'D:\Projects\public-ip-display.parcel-cache\7e\61a8811fbb6695cf83f7b7ad8cd16a.v8.7048.0.9' -> 'D:\Projects\public-ip-display.parcel-cache\7e\61a8811fbb6695cf83f7b7ad8cd16a.v8'

  • invoking yarn mistakenly in my pnpm repo

Installing @parcel/transformer-sass...
@parcel/package-manager: yarn: No lockfile found.
yarn: [1/4] Resolving packages

  • two dozen deprecation notices, but they're from my project's dependencies so no biggie
  • a hundred warnings about babel missing, which I hope parcel installs for itself under better conditions if it needs it

has unmet peer dependency "@babel/core@^7.0.0-0"

  • a file error

@parcel/package-manager: yarn: An unexpected error occurred: "EEXIST: file already exists, mkdir 'D:\Projects\public-ip-display\nodemodules\parcel-plugin-web-extension\nodemodules@parcel'".

  • finally it crashes on not being able to handle a png

× Build failed.
Error: No transformers found for D:\Projects\public-ip-display\src\images\error-128.png.

💁 Possible Solution

🔦 Context

My repo evergreens its dependencies but parcel1 is broken at the moment, saw a comment to try parcel2.

💻 Code Sample

https://gitlab.com/Marnes/public-ip-display/-/commit/c7750f84c3f7966d9f1923c4698d3cdd46a83b02

🌍 Your Environment

Software Version(s)
Parcel 2.0.0-nightly.610
Node 14.16.0
npm/Yarn pnpm 5.18.1
Operating System win10
@mischnic
Copy link
Member

mischnic commented Mar 3, 2021

invoking yarn mistakenly in my pnpm repo

#3408 / #5951

You can run with --no-autoinstall for now and install them manually

EPERM: operation not

We haven't been able to track that down yet: #5036 / #4955

a hundred warnings about babel missing, which I hope parcel installs for itself under better conditions if it needs it

We are aware of that, you should install @babel/core yourself for now

finally it crashes on not being able to handle a png

https://v2.parceljs.org/getting-started/migration/

@leaumar
Copy link
Author

leaumar commented Mar 3, 2021

Great to see it's all tracked then, feel free to close if this issue is redundant.

Thanks for the fix tips, I'll try them. I did follow the migration guide, the header about images refers to "Importing assets from JS" which I'm not doing, I've specified my assets on the commandline with a wildcard. If the parcelrc thing is necessary for assets specified that way too, I suggest changing the header to make that clear. 🙂

@leaumar
Copy link
Author

leaumar commented Mar 3, 2021

Although one note, my issue isn't so much the lacking support for pnpm, but rather that parcel should fail when it does not detect a yarn repo rather than invoking yarn anyway.

@mischnic
Copy link
Member

mischnic commented Mar 3, 2021

does not detect a yarn repo

There's also the (uncommon) case that you don't have any lockfile

@leaumar
Copy link
Author

leaumar commented Mar 3, 2021

Which falls under "we don't know your package manager", which should be met with an error instead of yarn being invoked on no basis. 🙂

@mischnic
Copy link
Member

mischnic commented Mar 5, 2021

So pnpm should now be working correctly. Do you still run into some problem that isn't already covered by some other issue I linked?

@leaumar
Copy link
Author

leaumar commented Mar 5, 2021

Well, next I ran into Cannot find module "@parcel/config-default", for which I saw in #5603 that @parcel/config-default should be installed. I did, and next I got an error that currently matches no open tickets as far as I can see:

Installing @parcel/transformer-raw...
@parcel/package-manager: Unexpected store location
Error: Unexpected store location
at Object.checkCompatibility [as default] (C:\ProgramData\nvs\node\14.15.1\x64\node_modules\pnpm\dist\pnpm.js:86164:13)
at C:\ProgramData\nvs\node\14.15.1\x64\node_modules\pnpm\dist\pnpm.js:86633:37
at Array.map ()
at validateModules (C:\ProgramData\nvs\node\14.15.1\x64\node_modules\pnpm\dist\pnpm.js:86631:32)
at Object.getContext [as default] (C:\ProgramData\nvs\node\14.15.1\x64\node_modules\pnpm\dist\pnpm.js:86529:30)
at async Object.mutateModules (C:\ProgramData\nvs\node\14.15.1\x64\node_modules\pnpm\dist\pnpm.js:110970:17)
at async Object.handler [as default] (C:\ProgramData\nvs\node\14.15.1\x64\node_modules\pnpm\dist\pnpm.js:113753:33)
at async Timeout._onTimeout (C:\ProgramData\nvs\node\14.15.1\x64\node_modules\pnpm\dist\pnpm.js:123063:22)
Installing @parcel/transformer-html...
@parcel/package-manager: Unexpected store location
Error: Unexpected store location
at Object.checkCompatibility [as default] (C:\ProgramData\nvs\node\14.15.1\x64\node_modules\pnpm\dist\pnpm.js:86164:13)
at C:\ProgramData\nvs\node\14.15.1\x64\node_modules\pnpm\dist\pnpm.js:86633:37
at Array.map ()
at validateModules (C:\ProgramData\nvs\node\14.15.1\x64\node_modules\pnpm\dist\pnpm.js:86631:32)
at Object.getContext [as default] (C:\ProgramData\nvs\node\14.15.1\x64\node_modules\pnpm\dist\pnpm.js:86529:30)
at async Object.mutateModules (C:\ProgramData\nvs\node\14.15.1\x64\node_modules\pnpm\dist\pnpm.js:110970:17)
at async Object.handler [as default] (C:\ProgramData\nvs\node\14.15.1\x64\node_modules\pnpm\dist\pnpm.js:113753:33)
at async Timeout._onTimeout (C:\ProgramData\nvs\node\14.15.1\x64\node_modules\pnpm\dist\pnpm.js:123063:22)

× Build failed.
Error: Failed to install @parcel/transformer-raw: pnpm failed to install modules
Error: Failed to install @parcel/transformer-raw: pnpm failed to install modules
at install (D:\Projects\public-ip-display\node_modules.pnpm@parcel\package-manager@2.0.0-nightly.617_51718db9b6ddd399d6cc07b7247a6465\node_modules@parcel\package-manager\lib\installPackage.js:171:11)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async PromiseQueue._runFn (D:\Projects\public-ip-display\node_modules.pnpm@parcel\utils@2.0.0-nightly.617\node_modules@parcel\utils\lib\PromiseQueue.js:108:7)
at async PromiseQueue._next (D:\Projects\public-ip-display\node_modules.pnpm@parcel\utils@2.0.0-nightly.617\node_modules@parcel\utils\lib\PromiseQueue.js:95:5)

My store location is set using an env var: npm_config_store_dir=D:\Projects\.pnpm-store

@leaumar
Copy link
Author

leaumar commented Mar 5, 2021

Adding the missing dependencies manually leads to

× Build failed.
@parcel/bundler-default: Got unexpected undefined
Error: Got unexpected undefined
at nullthrows (D:\Projects\public-ip-display\node_modules.pnpm\nullthrows@1.1.1\node_modules\nullthrows\nullthrows.js:7:15)
at BundleGraph.getReferencingBundles (D:\Projects\public-ip-display\node_modules.pnpm@parcel\core@2.0.0-nightly.615\node_modules@parcel\core\lib\BundleGraph.js:790:48)
at BundleGraph.getBundleGroupsContainingBundle (D:\Projects\public-ip-display\node_modules.pnpm@parcel\core@2.0.0-nightly.615\node_modules@parcel\core\lib\BundleGraph.js:804:48)
at D:\Projects\public-ip-display\node_modules.pnpm@parcel\core@2.0.0-nightly.615\node_modules@parcel\core\lib\BundleGraph.js:433:64
at Array.every ()
at BundleGraph.removeBundleGroup (D:\Projects\public-ip-display\node_modules.pnpm@parcel\core@2.0.0-nightly.615\node_modules@parcel\core\lib\BundleGraph.js:433:43)
at MutableBundleGraph.removeBundleGroup (D:\Projects\public-ip-display\node_modules.pnpm@parcel\core@2.0.0-nightly.615\node_modules@parcel\core\lib\public\MutableBundleGraph.js:252:41)
at Object.bundle (D:\Projects\public-ip-display\node_modules.pnpm@parcel\bundler-default@2.0.0-nightly.617\node_modules@parcel\bundler-default\lib\DefaultBundler.js:295:21)
at BundlerRunner.bundle (D:\Projects\public-ip-display\node_modules.pnpm@parcel\core@2.0.0-nightly.615\node_modules@parcel\core\lib\BundlerRunner.js:276:21)
at async Parcel._build (D:\Projects\public-ip-display\node_modules.pnpm@parcel\core@2.0.0-nightly.615\node_modules@parcel\core\lib\Parcel.js:669:11)

Which I think is tracked somewhere already.

@morellodev
Copy link

morellodev commented May 8, 2022

I found a workaround: setting shamefully-hoist=true in your .npmrc file solves the issue (reference here).

alejandronanez added a commit to alejandronanez/turborepo-nextjs-starter that referenced this issue May 11, 2022
PNPM is having issues while installing @parcel/ modules that are supposed to live at the root level directory.

https://pnpm.io/npmrc#public-hoist-pattern
parcel-bundler/parcel#5950 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants