yarnpkg / website

Yarn package manager website
https://classic.yarnpkg.com
434 stars 984 forks source link

[Docs] Manual install via tarball is incorrect #214

Closed felixsanz closed 9 months ago

felixsanz commented 8 years ago

I've created a PR in #213 fixing the tar command but it's still wrong because if you do so, you get /opt/dist/bin/yarn which is probably incorrect since there is no scope.

This can be fixed with mkdir -p /opt/yarn and passing -C /opt/yarn to tar command, but i'm creating this issue because that's not how i think you want it.

The docs say:

# Yarn is now in /opt/yarn-[version]/

So looks like you want the version number in the directory (i wouldn't do that). So... discuss.

This is what i end doing:

mkdir -p /opt/yarn
wget -qO- https://yarnpkg.com/latest.tar.gz | tar xvz --strip-components=1 --no-same-owner -C /opt/yarn
ln -s /opt/yarn/bin/yarn.js /usr/bin/yarn

and then yarn works.

(Linux only)

jamiebuilds commented 8 years ago

cc @Daniel15

Daniel15 commented 8 years ago

Yeah, we didn't fix the directory name in the tarball (https://github.com/yarnpkg/yarn/issues/431), and now people are probably relying on the fact it has a dist directory so I'm not sure if we could change it 😕 The docs on the site were written for the ideal state of things.

I think your proposed solution is fine though (extracting to /opt/yarn), would you like to send a pull request to update it?

So looks like you want the version number in the directory (i wouldn't do that).

This is how pretty much every piece of Linux software does it though. Try download the tarball of any Linux app and most likely it'll contain a directory with the app name and version number. Some examples of directory names in tarballs:

jamiebuilds commented 8 years ago

@Daniel15 can change it in the next 0.x release, better to do it now than later.

felixsanz commented 8 years ago

It is possible to also remove the dist directory? It's the first level directory and everything is inside, so there is no point in having it inside the tarball. This way we avoid --strip-components=1 which is not a valid option on some versions on tar (like the one shipping by default in alpine linux)

Daniel15 commented 8 years ago

In general, all archives should have a top-level directory. It's normally done to avoid making a mess of the file system (eg. downloading an archive to /opt or /usr/local and then extracting it should put everything in a directory rather than directly extracting everything at the root level).

I could be wrong, but I don't know of any software package that ships tarballs without everything contained within a top-level directory.

felixsanz commented 8 years ago

So let's call it yarn and not dist. I agree most applications have a top level directory but they name the folder as the package being installed. This way we can unpack it into /opt directly and it will create a /opt/yarn hierarchy. /opt/dist is weird (and even wrong). The same as with /opt/yarn/dist/.

Two examples: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.2.10.tgz -> mongodb-linux-x86_64-3.2.10 http://www.aerospike.com/download/server/3.10.0.3/artifact/tgz -> aerospike-server