Yarn global command not working

后端 未结 9 1916
孤独总比滥情好
孤独总比滥情好 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 14:05

    You should add export PATH="$PATH:$(yarn global bin)" to your ~/.bash_profile or whatever you use. It would solve the issue.

    Depending on how you installed it, Yarn's global folder varies for some reason. You can follow this issue here.

    0 讨论(0)
  • 2020-12-12 14:10

    To reinstall run below.

    brew install -g yarn
    

    // Note:(updating homebrew) for Mac users.

    brew reinstall yarn
    

    // (if yarn is still not found)

    0 讨论(0)
  • 2020-12-12 14:10

    AndrewD gave a great answer, but for those on Windows it's a bit different, especially step 3.

    Please do not use the command setx as @Thapedict said. It will remove all your previous paths you had and replace it with only the given directory. If you want to use setx, I think there might be a flag to make it append the existing path variables, but I don't know which one. Using only setx will not append to it.

    I would just do System Properties > Advanced > Environment Variables > Edit Path > New > c:\users\YOURUSERNAME\appdata\local\yarn\bin

    to make sure you don't remove your previous variables.

    0 讨论(0)
提交回复
热议问题