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.

Yarn@Berry support

See original GitHub issue

Description

[Description of the issue] Using bud in a project that uses Yarn@Berry don’t work. I received error:

(node:23777) [ERR_REQUIRE_ESM] Error Plugin: @roots/bud [ERR_REQUIRE_ESM]: Must use import to load ES Module: /{FOLDER_ROOT}/node_modules/@roots/bud/node_modules/globby/index.js
require() of ES modules is not supported.
require() of /{FOLDER_ROOT}/node_modules/@roots/bud/node_modules/globby/index.js from /{FOLDER_ROOT}/node_modules/@oclif/config/lib/plugin.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /{FOLDER_ROOT}/node_modules/@roots/bud/node_modules/globby/package.json.

I found out, that Yarn@Berry installs @roots/bud dependencies in it’s folder and so there is a globby there. When I just use normal Yarn everything works.

Steps to reproduce

  1. Init simple project with npm init
  2. Change yarn: yarn set version berry
  3. Install bud: yarn add @roots/bud @roots/bud-cli --dev
  4. run yarn bud init

Expected behavior: Should not crash

Actual behavior: Crashes bud

Reproduces how often: [What percentage of the time does it reproduce?] everytime

Versions

@roots/bud: ^4.7.0-10 @roots/bud-cli: ^4.7.0-10

macOS 11.3.1 Yarn: 1.22.11 Yarn Berry: 3.0.1 Node: 14.17.5

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ceesvanegmondcommented, Dec 15, 2021

@kellymears This issue is still there with the latest 5.0.0-next19. Adding the resolutions fixes this in 5.0 as well.

0reactions
kellymearscommented, Jan 6, 2022

I’m closing this issue in favor of #941, which should address the underlying cause. This isn’t a problem with yarn. This is a problem with modern JS 🥲

Read more comments on GitHub >

github_iconTop Results From Across the Web

yarnpkg/berry: Active development trunk for Yarn - GitHub
Yarn supports Node by default but isn't limited to it - plugins can add support for other languages; Yarn supports workspaces natively, and...
Read more >
Support for Yarn 3 - Depfu Blog
We've now launched support for Yarn Berry and the important bit here is that we only support v3 and not v2. Yarn 3...
Read more >
Plug'n'Play | Yarn - Package Manager
Native support; Support via plugins; Incompatible. Frequently Asked Questions. Why not use import maps? Packages are stored inside Zip archives: How can I ......
Read more >
Advanced package manager features for npm, Yarn, and pnpm
Debugging issues with dependencies in Yarn Berry PnP. To debug issues with dependencies, you need additional tool support (e.g., ...
Read more >
Problems with Intellisense with Yarn (berry) 2 PnP and ...
Questions in bold. Webstorm (tried 2020.2.2 and 2020.2.3RC) on Windows 10 x64 Webstorm should support Yarn 2 and PnP since 2019.3+ Is it......
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