diff --git a/plugins/yarn/yarn.plugin.zsh b/plugins/yarn/yarn.plugin.zsh index a4f595c61..9ba24420a 100644 --- a/plugins/yarn/yarn.plugin.zsh +++ b/plugins/yarn/yarn.plugin.zsh @@ -1,5 +1,8 @@ -# Add yarn bin directory to $PATH if it exists and not in $PATH already -bindir=$(yarn global bin 2>/dev/null) \ +# Skip yarn call if default global bin dir exists +[[ -d "$HOME/.yarn/bin" ]] && bindir="$HOME/.yarn/bin" || bindir="$(yarn global bin 2>/dev/null)" + +# Add yarn bin directory to $PATH if it exists and not already in $PATH +[[ $? -eq 0 ]] \ && [[ -d "$bindir" ]] \ && (( ! ${path[(Ie)$bindir]} )) \ && path+=("$bindir")