'yarn set version berry' requires deletion of .yarnrc.yml
See original GitHub issue- I’d be willing to implement a fix
Describe the bug
Sometimes I am trying to install berry. I may have copied some config files over to a repo that wasn’t previously using berry, or I may have changed some stuff in a monorepo and, for whatever reason, berry isn’t installed and .yarn is not present.
To Reproduce
Problem 1:
- Attempting to install berry will error if the
.yarnrc.yml
is present:
> yarn set version berry
node:internal/modules/cjs/loader:928
throw err;
^
Error: Cannot find module '.yarn/releases/yarn-berry.cjs'
- To get around it I use a silly file called
.yarn-bootstrap.sh:
#!/bin/sh
mv .yarnrc.yml .yarnrc.yml.bak
touch .yarnrc.yml
yarn set version berry
yarn plugin import workspace-tools
mv .yarnrc.yml.bak .yarnrc.yml
This script should not be needed and berry should be resilient to install without requiring a deleted config file.
Problem 2:
- Plugins specified in the
.yarnrc.yml
cannot be installed without removing them from the.yarnrc.yml
:
> yarn plugin import workspace-tools
Internal Error: Cannot find module '.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs'
Require stack:
- .yarn/releases/yarn-berry.cjs
An easy version for the user could be for the yarn
command to automatically download the berry release and plugins specified in .yarnrc.yml
if they are missing.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Configuration options | Yarn - Package Manager
List of all the configuration option for Yarn (yarnrc files)
Read more >yarn install leads to Cannot find module yarn-berry.js
After you run yarn set version stable and you add nodeLinker: node-modules to the .yarnrc.yml file, you need to run yarn install again....
Read more >Configure and use Yarn with CodeArtifact - AWS Documentation
The following procedure details how to configure Yarn 2.X by updating your .yarnrc.yml configuration from the command line with the yarn config set...
Read more >Javascript/Nodejs/yarn-plugin-apt - Debian Wiki
Creating a yarn plugin to resolve node modules installed as debian packages via ... yarnpkg set version berry $ if ! grep nodeLinker...
Read more >Using yarn v2 berry with create-react-app - Leo Pradel
We need to tell yarn that we want to use berry for this project. yarn set version berry. Now let's install our dependencies...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Tools like this shouldn’t require you to add binary files to your repo, config files should be enough
I mean, that’s our tool, so if we tell you how to use it but you prefer to ignore recommendations and do differently, it’s fine, but you have to expect that you may not hit the happy path, and thus have to build some additional scripts to get the logic you want.