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.

[Bug] Bugs blocking usage of Berry

See original GitHub issue

Describe the bug

I am trying to use Berry on existing projects. I’m running into multiple blockers, and some UX issues. I tried to look at using Berry with a beginner-mindset, blending out any sort of knowledge I may have about existing projects or dependency management. This bug report was filed to help identify a few ways in which Berry could help beginners successfully migrate to Berry.

  • UX: After running Berry it reported that it “Failed with errors”. It was unclear what to do next, and whether it was a legitimate error or not. I had to open a log file in a temporary folder to see that a module could not be resolved (triggered through running postinstall after yarn?). Since this is caused through my usage of Berry, and wouldn’t happen with Yarn 1 or npm, I believe it could be made clearer what the next steps should be.
  • UX: On first-run, Berry spams my terminal with one message per package that needs to be downloaded. For a large project, that can be tens of pages of terminal windows.
  • Bug: After trying to run yarn jest to run tests, Berry couldn’t resolve modules across the workspace and failed with an unhandled promise rejection. I was left in a state where I’m unable to know how to continue.
  • Bug: Trying to run yarn policies set-version <anything> when Berry is active resulted in an error Couldn't find a script named "policies".. I am unclear how to revert to Yarn 1.
  • Perf: the link step for repeated invocations of Berry takes multiple seconds, as opposed to Yarn 1 which is immediate.
  • Behavior change: It appears Berry does either not print the output of postinstall steps or doesn’t run them on repeated invocations (Tested on the Metro repo which builds all files on every invocation of Yarn). Is this expected?
  • UX: Berry does not print anything to the terminal when running a command, which feels like something got stuck when running a slow command (like eslint for example).
  • UX: I tried to run yarn policies set-version berry in a project with an older version of Yarn (1.17). The policies command was not found, but it was unclear that this was a command only added recently. I don’t know what could be done on existing versions but at least documentation could be clearer about updating Yarn 1 to the latest
  • UX (subjective): Every line printed by Berry has a vertical bar (|) which looks visually jarring at times.
  • UX (subjective): Every line contains > YN0 which feels repetitive.

Feel free to split these out into separate issues. My intent is to document the complete flow I went through and the issues that came up. I also tried Yarn on another smaller and older project. Because many of the dependencies were using versions that were old I could not get Berry to work. It may help to point out in the migration guide that all dependencies should be updated to the latest versions before changing dependency managers. It would be amazing if Berry could fail on install and tell me which versions of packages are known to work with Berry (ie. if I’m using an old version of resolve, Berry could automatically tell me which version is compatible).

To Reproduce

git clone git@github.com:facebook/jest.git
cd jest
yarn policies set-version berry
yarn

Screenshots

Screen Shot 2020-01-28 at 09 57 20 Screen Shot 2020-01-28 at 09 57 14 Screen Shot 2020-01-28 at 09 58 42

Environment if relevant (please complete the following information):

  • OS: macOS
  • Node version: v12.8.0
  • Yarn version: berry

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:14
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
arcaniscommented, Jan 28, 2020

Hey, thanks for that 🙂

Bug: Trying to run yarn policies set-version <anything> when Berry is active resulted in an error Couldn’t find a script named “policies”… I am unclear how to revert to Yarn 1.

Related to #472

Perf: the link step for repeated invocations of Berry takes multiple seconds, as opposed to Yarn 1 which is immediate.

1.x was “cheating” by just not running at all if the .yarn-metadata had an older mtime than the package.json and yarn.lock files. It’s a fine approach, but here we follow a slightly different one where we want to run the full code path and make it fast (not the source, but this tweets sums it up perfectly: https://twitter.com/jordwalke/status/959018527091904512).

I find this approach important because the bypass had side effects that made the execution slightly unpredictable from the perspective of tooling (cf next point). For example as another data point, running yarn install here will always ensure that your cache is sound instead of just passing if one mtime happens to be the right one.

Behavior change: It appears Berry does either not print the output of postinstall steps or doesn’t run them on repeated invocations (Tested on the Metro repo which builds all files on every invocation of Yarn). Is this expected?

The 2.x will not print the logs for successful builds (just like 1.x), but it will also not run the postinstall scripts unless the dependency tree changed. The 1.x tried to have a similar behaviour (for example the bypass previously mentioned caused the postinstall scripts to not be run on every install) but was fairly buggy and sometimes unpredictable in this aspect.

UX: I tried to run yarn policies set-version berry in a project with an older version of Yarn (1.17). The policies command was not found, but it was unclear that this was a command only added recently. I don’t know what could be done on existing versions but at least documentation could be clearer about updating Yarn 1 to the latest

Yep, we should mention upgrading 1.x before installing 2.x 👍

It would be amazing if Berry could fail on install and tell me which versions of packages are known to work with Berry (ie. if I’m using an old version of resolve, Berry could automatically tell me which version is compatible).

That’s something we consider. The plugin-compat is here for this kind of purpose (for example it automatically adds the missing package extensions we’re aware of), and we’ll keep improving it based on similar feedback.

UX: On first-run, Berry spams my terminal with one message per package that needs to be downloaded. For a large project, that can be tens of pages of terminal windows.

It won’t work for first-time users, but for regular use we’ll implement #816 which will make it possible to filter out the messages you don’t want to see. By default I find the full list valuable though - the typical progress bars used to make it difficult to know what was causing hangs, especially when people shared screenshots.

(fails on yarn start with Failed to start Docusaurus server: Error: EROFS: read-only filesystem, open ‘/node_modules/docusaurus/lib/core/metadata.js’ – unclear how to proceed)

We try to throw the regular filesystem errors as much as possible when working with zip archives, hence the EROFS (Error Read-Only FS). I’ll add it to the troubleshooting though (basically it means that Docusaurus is writing within its own package folder instead of something like /node_modules/.cache/docusaurus).

1reaction
arcaniscommented, Jan 31, 2020

We were thinking with @gaetanmaisse that maybe the Yarn org could provide an helper package to store package artifacts. Maybe that would be good opportunity to mutualize efforts?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Role of lygus bug and other factors in strawberry fruit deformity
Deformed berries are not marketable for fresh market and growers adopt various control strategies to manage lygus bugs and limit damage.
Read more >
Why you shouldn't worry about eating the bugs that live ... - CNN
Bugs crawling on your strawberries? That's normal, according to some experts, despite a recent TikTok trend that suggests otherwise.
Read more >
Why Are There Wormy Bugs in Strawberries? - Health
How Do You Prevent Bug Infestations in Berries? · Use of exclusion netting to physically block pests from fruit · Cultural control methods,...
Read more >
Crystal Berry | Bug Fables Wiki - Fandom
Crystal Berries are collectible items that can be found throughout Bugaria. There are 50 in total, and are used to trade for medals...
Read more >
More non-chemical pest controls for berry growers
Insect pests can make or break a berry crop – but so can consumer sentiment regarding the insecticides you use to control them....
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