Reputation: 73
Looks like I have managed to scramble my path variable when installing flutter, and now running yarn, shows zsh: command not found: yarn
This was the command I ran that I started experiencing the zsh command not found:
echo 'export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin >> ~/.zshrc"
I ran the code solution suggested by @devnull https://stackoverflow.com/a/18428774/1766068
PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
export PATH
it would work when I open a new tab, but if I should restart the terminal it no longer works.
Upvotes: 1
Views: 4214
Reputation: 4046
corepack enable
I use corepack enable
to install yarn, following the official yarn installation instructions.
Official yarn docs say "enabling Corepack [...] will add the yarn binary to your PATH." When I update my Node or npm version, I have occasionally had the error message reappear.
Official Corepack docs explain its sole purpose is "to help with managing versions of your package managers. It [...] will identify whatever package manager is configured for the current project, download it if needed, and finally run it." Pretty handy.
This fix addresses this error each time with no drama.
Upvotes: 0
Reputation: 5459
Open your ~/.zshrc
file in a text editor and remove the last line. Then logout and login again.
Upvotes: 2