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.pwd
The "print working directory" above should output something like.
/Users/postsrc
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.vim .zshrc
or if you are using bash:
vim .bashrc
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".
export PATH="~/.composer/vendor/bin:$PATH"
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.source ~/.bashrc
source ~/.zshrc
Now do run the "laravel" command in the terminal and try whether it can be executable or not.
laravel
Leave a reply