Fix Laravel Command not found in ZSH or BASH in Ubuntu/WSL2

Make sure you have added laravel via composer. Just Type this command in terminal and hit enter.

$ composer global require "laravel/installer"

For zsh and bash:

$ cd ~
$ export PATH="$HOME/.config/composer/vendor/bin:$PATH"
$ source ~/.zshrc
$ source ~/.bashrc

For bash only:

$ cd ~
$ export PATH=~/.config/composer/vendor/bin:$PATH
$ source ~/.bashrc

Note : if still you are getting that error again, please edit .zshrc/.bashrc and add path manually path.

$ nano ~/.zshrc

add this line

export PATH=~/.config/composer/vendor/bin:$PATH"

Press ‘ctrl+s’ for save and ‘ctrl+x’ to exit.