Yarn global command not working

后端 未结 9 1945
孤独总比滥情好
孤独总比滥情好 2020-12-12 13:07

I\'m working with Yarn v0.16.1. If I understand correctly (according to the documentation), yarn global add should be the equivalent of np

9条回答
  •  北荒
    北荒 (楼主)
    2020-12-12 13:50

    Here's the process I used on Mac OSX El Capitan.

    1. Try to install yarn (I used the Curl command) if you have it already. This will bring up if its already installed and will give you the current directory where it exists.

    Like this:

    curl -o- -L https://yarnpkg.com/install.sh | bash
    

    It will display something like this:

    Installing Yarn!
    > /Users/{Your Username}/.yarn already exists, possibly from a past Yarn install.
    > Remove it (rm -rf /Users/{Your Username}/.yarn) and run this script again.
    

    Do not remove it. Move on to step 2.

    1. Copy the directory listed above. Open your profile. I'm using zsh. So mine was ~/.zshrc. You can find yours and more info here.

    2. Copy the following (replacing your directory and username details as necessary, the one you got from the installation error message).

      alias yarn="/Users/{Your Username}/.yarn/bin/yarn"

    1. Try to run yarn version to check if its working. If it is, you should see a version number displayed in your terminal.

    That's it, and what worked for me.

提交回复
热议问题