Yarn: Add in documentation "Install from npm"

Created on 15 Oct 2016  路  13Comments  路  Source: yarnpkg/yarn

Since yarn is a npm package it can also be installed as it. So that, please add in the documentation that you can install yarn executing next line:

npm install -g yarn

Most helpful comment

For folks coming from npm, which I imagine is most users, it's easy enough to remember npm i -g yarn compared to whatever wget, curl, apt-get, brew, yum, choco, or other alternative and it works across all platforms. I program on OS X and Windows pretty regularly so it's nice to have a handy, easy, cross platform install route. I assumed the npm route was moved to avoid jokes about using it to install another package manager.

All 13 comments

It's listed on the install page under "Alternatives".

image

Yes, it's on the "alternatives" tab as it's not the recommended installation method. It's primarily a fallback for environments where you can't use a native installer or package (for example, Mac OS before the Homebrew package was recently added). Going to close this out as this is working as intended. Thanks!

For folks coming from npm, which I imagine is most users, it's easy enough to remember npm i -g yarn compared to whatever wget, curl, apt-get, brew, yum, choco, or other alternative and it works across all platforms. I program on OS X and Windows pretty regularly so it's nice to have a handy, easy, cross platform install route. I assumed the npm route was moved to avoid jokes about using it to install another package manager.

it's easy enough to remember npm i -g yarn compared to whatever

Anyone on Ubuntu should be familiar with dpkg (apt-get). Similarly, most people on Mac OS are familiar with Homebrew. Yarn should be seen as an "app" not an "npm package", and the best practice for apps is to use the native installation method for the host operating system.

I assumed the npm route was moved to avoid jokes about using it to install another package manager.

That's one reason 馃槢 Here's one of my comments from a few weeks ago (#385) that explains some of the rationale:

Advantages of using the system's native package manager rather than something like npm install -g yarn:

  • Upgrades are handled the same way as all other software on your system (apt-get upgrade). It's not a special snowflake.
  • All the security problems with npm (eg. packages not being signed) make it less than ideal for anything installed system wide. apt-get gives you proper GPG signature verification.
  • Using npm means you're tightly-coupled to npm. If you later want to have a better installation solution, you need to have this awkward transition period where you try to get users to switch to the newer installation method.
  • The setup instructions need the whole weird "_install Node.js first, then ensure npm is up-to-date, then install Yarn_" thing. That'd be like telling people to manually install their npm dependencies 馃槅 . With a proper package management system, the Yarn package would simply have a dependency on the Node.js package, and "apt-get install yarn" would install both.

If we want to appeal to people that have limited Node.js experience, we shouldn't make any assumptions that they know anything about the Node.js ecosystem or what "npm" even is.

@Daniel15

If we want to appeal to people that have limited Node.js experience, we shouldn't make any assumptions that they know anything about the Node.js ecosystem or what "npm" even is.

I donno, for folks with limited Node experience on Mac and Windows the go-to Node installs come bundled with npm and it's ingrained in the ecosystem. I get wanting a separation and a separate identity but think it's a lot of hoops to jump through to avoid.

think it's a lot of hoops to jump through to avoid.

There's not really that many hoops though. It's identical to any other software you'd use on Windows or Mac OS. We're not doing anything strange or different to other apps at all 馃槃

There's not really that many hoops though.

Lets let a couple releases go by :D

Related to #1201, #1202, #1216, #1447, #1505.

For what it's worth, releases are much easier to deal with when using the Ubuntu/Debian package, as Yarn will be upgraded along with the rest of the system. npm won't give you that; apt-get update && apt-get upgrade doesn't touch things installed via npm install --global. My understanding is that you need to manually update with npm.

Can yarn update itself without breaking? If so, installing with npm would mean that it can be updated using yarn, right?

I know tools like greenkeeper can detect when they're out of date and prompt the user to action.

Can yarn update itself without breaking?

There's a yarn self-update command but I'm not sure if it works 100% properly at the moment.

you are too dependent on package managers doing the right thing for you, with containerization and limited build environments first and foremost we need a manual install that always works. Barring that the primary language package manager should be able to install it. Package management systems for dists are the last resort, they rarely have the latest package to install and you have to fall back to the other methods anyway.

We have the installation script if you need a manual install that always works. Alternatively you can extract the tarball yourself.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sebmck picture sebmck  路  3Comments

FLGMwt picture FLGMwt  路  3Comments

AzGoalie picture AzGoalie  路  3Comments

MunifTanjim picture MunifTanjim  路  3Comments

ocolot picture ocolot  路  3Comments