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
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.
To reinstall run below.
brew install -g yarn
// Note:(updating homebrew) for Mac users.
brew reinstall yarn
// (if yarn is still not found)
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.