Often times after installing Laravel from the composer package manager, you face the "Laravel Command Not Found" error and the cause of this is that the executable "laravel" command is not found in the path. In this short snippet, you will learn how to fix and resolve this error.
Step 1: Open iTerm or Terminal
The first step is to open your Terminal and then make sure you are within your "user" path.
The "print working directory" above should output something like.
Step 2: Update .zshrc or .bashrc
Depending on your terminal you might be using ZSH or Bash. If you are using ZSH then the config will be inside the ".zshrc" otherwise the ".bashrc" file.
Next, open and edit the file with "vim" editor by writing the command below.
or if you are using bash:
And then press "i" for interaction which allows you to edit the text and then paste the export line below using the command "command + v".
once you have done that, type in ":wq" (colon + wq) which will write and quit from the vim edit mode.
Restart/Refresh the Terminal
Do restart to refresh the terminal or otherwise just call the "source ~/.bashrc" or "source ~/.zshrc" to get the latest config you just updated.
Now do run the "laravel" command in the terminal and try whether it can be executable or not.