Berry: [Question] Yarn 2 install confusion

Created on 19 Feb 2020  路  4Comments  路  Source: yarnpkg/berry

I hope this is a good spot to ask this, if not feel free to delete this.

I went to see how to install yarn 2 and it says I use yarn 1 to install it :confused:

I'm mainly confused on why I'd keep an older version of yarn just to install the new version on all my projects (which seems tedious), did yarn 2 switch to be something else? I'm lost on why a package manager would be installed per project instead of being global.

bug

All 4 comments

I agree with @eman1986, especially on the "seems tedious" part: it seems weird to have to have the 5 MiB JS script of Yarn with the sole purpose of loading another script for Berry. On my Docker build, I ended up writing a shell script to /usr/bin/yarn to minimize the image:

#!/bin/sh
awk '/^yarnPath:/ { print $2 }' .yarnrc.yml | xargs -I '{}' node {} $*

Maybe we could have a yarn-slim which only supports reading local .yarnrc.yml and yarn set version?

I think the reasoning behind having each project use a specific version is explained in the Q&A:

You will want to keep them versioned (this prevents potential issues if, say, two engineers use different Yarn versions with different features).

Arguably that should also be on the Getting started guide since it is a somewhat unexpected behaviour when coming from npm or Yarn 1.

my concern is that tools like vue cli, angular cli are global tools and you use yarn or npm to install them that way, if yarn 2 is per project that's going to be messy to install global tools like that unless you have yarn 1 (which again is making my brain ache on needing 1 to use the other) or just use npm for those things I suppose.

I think there should have been better explaination on the reasoning on the migration page.

My big question is, will yarn 2 eventually get its own installer or will yarn 1 always seem to exist just to install yarn 2? or will you eventually have us use npm to install yarn 2 once yarn 1 is put out into retirement? I'm assuming yarn 1 is going to eventually be retired.

Related: https://github.com/yarnpkg/berry/issues/766#issuecomment-580658470

Basically all existing projects expect Yarn 1.x, and even though they should theoretically be compatible with Yarn 2.x, in practice they often require a migration pass that many people won't want to do. As a result, and to avoid breaking setups and lose trust, we prefer to err on the cautious side and assume that projects that don't explicitly ask for a version will use the 1.x.

My big question is, will yarn 2 eventually get its own installer or will yarn 1 always seem to exist just to install yarn 2? or will you eventually have us use npm to install yarn 2 once yarn 1 is put out into retirement? I'm assuming yarn 1 is going to eventually be retired.

Cf the post I linked.

Arguably that should also be on the Getting started guide since it is a somewhat unexpected behaviour when coming from npm or Yarn 1.

Yep, it would be a good idea.

That link answered my question, Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

janicduplessis picture janicduplessis  路  4Comments

chrisands picture chrisands  路  3Comments

milichev picture milichev  路  3Comments

Mike-Dax picture Mike-Dax  路  3Comments

IanVS picture IanVS  路  4Comments