question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Compatibility with yarn v2

See original GitHub issue

When running in the context of Yarn v2 Pnp, this plugin fails with the error.

Example with react-grid-layout:

[!] (plugin postcss) Error: EISDIR: illegal operation on a directory, read
../../../.yarn/$$virtual/react-grid-layout-virtual-663c3a9629/0/cache/react-grid-layout-npm-0.16.6-5842f88c2d-2.zip/node_modules/react-grid-layout/css/styles.css

The only workaround is to yarn unplug react-grid-layout

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:9

github_iconTop GitHub Comments

2reactions
telaoumatenyaniscommented, Apr 15, 2020

I explored a bit this repo and also postcss-load-config repo.

The bug starts here:

https://github.com/egoist/rollup-plugin-postcss/blob/026504ef0480910e830873c30c5b133e2a130a64/src/postcss-loader.js#L23

Here, as there is no configPath, id is used to set the configPath variable. This variable is then passed as the path argument of findPostcssConfig (from postcss-load-config). Its value is the path of the folder of the required file (e.g.: .yarn/$$virtual/react-grid-layout-virtual-663c3a9629/0/cache/react-grid-layout-npm-0.16.6-5842f88c2d-2.zip/node_modules/react-grid-layout/css/).

This path is then passed to cosmiconfig as the search path.

https://github.com/michael-ciniawsky/postcss-load-config/blob/bdaf431ef1142b5d0253aeb534aad8f42e46877e/src/index.js#L85-L95

This is where the error happens, I didn’t go deeper then here.

I am not an expert in yarn nor in cosmiconfig so I wouldn’t be able to tell you who is wrong here.

If you don’t need a postcss config, a workaround is:

      postcss({
        config: false
      })

If you still need one:

      postcss({
        config: {
          path: "./postcss.config.js"
        }
      })
1reaction
arcaniscommented, Apr 15, 2020

Funnily the responsibility for this bug is shared by both Yarn and cosmiconfig, as you can still reproduce it by creating a folder named “package.json”. But who does that? 😛

Anyway, I’ve fixed the Yarn part of the problem: https://github.com/yarnpkg/berry/pull/1204 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migration | Yarn - Package Manager
A step-by-step and in-depth migration guide from Yarn 1 (Classic) to Yarn 2 (Berry).
Read more >
It's 2021, and You Should Switch to Yarn 2 - Atomic Spin
1. Backwards Compatibility with node_modules ... Yarn 2 uses a new Plug'n'Play (PnP) architecture that is a huge departure from how npm projects ......
Read more >
Compatibility with yarn 2 (or yarn 1 PnP mode) #458 - GitHub
Current Behavior. Yarn v2 got a stable release today, and it uses PnP (instead of node_modules) exclusively
Read more >
What's the problem with Yarn 2? - Nicholas Martin
One of the biggest gripes engineers seem to have is that Yarn 2 is such a drastic change that it isn't even compatible...
Read more >
Yarn 2 — the future of package managers for JavaScript? - Snyk
How to get started with Yarn 2? Yarn has adopted a per-repository — or per-project if you will — install strategy which means...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found