Skip to content

Document that yarn global bin needs to be added to $PATH #142

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed

Conversation

fahrradflucht
Copy link

@fahrradflucht
Copy link
Author

fahrradflucht commented Oct 12, 2016

I thought about adding a recommendation on how to do this ( like adding export PATH="${PATH}:$(yarn global bin)" to your shell config, but I think since this works completely different on Windows (IIRC) I omitted that.

@cpojer
Copy link
Contributor

cpojer commented Oct 13, 2016

cc @kittens – can we make it so we put our global bins into /usr/local/bin just like npm does? I think that'll be much easier for people.

@fahrradflucht
Copy link
Author

@cpojer wouldn't that have the issues discussed here?

@Daniel15
Copy link
Member

This is already documented in the installation instructions: https://yarnpkg.com/en/docs/install. See "path setup" on the Mac OS and Linux tabs, and on Windows the installer modifies the path automatically.

@fahrradflucht
Copy link
Author

fahrradflucht commented Oct 19, 2016

@Daniel15 Ah I see. Based on the issue I was referring to, this gets missed sometimes anyway. Do you think I should change it to a little note to make sure that this done on Mac/Linux or do you think this should just be closed all together?

@tomchentw
Copy link

Thank @fahrradflucht. I need to add this to my .zshrc to make it work on my computer.

To clarify, here's my npm/node/yarn install steps:

  1. Install npm independently with curl script
  2. Install node with homebrew by this command: brew install node --without-npm
  3. Install yarn with homebrew: brew install yarn

After these steps, my result for yarn global bin is:

/usr/local/Cellar/node/6.9.1/bin

It's not under ~/.yarn/bin as the document suggests.

As such, I'll need to modify my .zshrc as follows:

export PATH="$(yarn global bin):$PATH"

Hope someone will find this helpful.

@carhartl
Copy link

Running export PATH="$PATH:`yarn global bin`" as suggested by the installation instructions slows down my shell startup noticeably , e.g. time to type. Is there a way to setup the path in a "static" way, while avoiding having to update my dotfiles each time a new node version is installed ("$PATH:/usr/local/Cellar/node/7.3.0/bin" => "$PATH:/usr/local/Cellar/node/7.4.0/bin")?

@carhartl
Copy link

... figured out where to look for: export PATH="$PATH:$HOME/.config/yarn/global/node_modules/.bin"

@Haroenv
Copy link
Member

Haroenv commented Oct 12, 2017

Sorry for the massive delay on this PR. With the current content this isn't necessary anymore I think. Feel free to reopen and I promise to look at the issues earlier

@Haroenv Haroenv closed this Oct 12, 2017
@ianchanning
Copy link

I've just hit this issue, there is nothing documenting that you need to add something to your $PATH to get yarn global add to work. I think this PR is still valid.

The current documentation seems to work around it by specifying that you must use a prefix argument. But then libraries such as Bucklescript installation (and ReasonML) use the default syntax:

yarn global add bs-platform

I raised a ReasonML issue #2168 about the undocumented requirement for adding something to your path for yarn global add, but they then claim that it is an issue with yarn.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants