📅  最后修改于: 2023-12-03 15:06:08.255000             🧑  作者: Mango
When working with a command line interface (CLI), such as Zsh, you may encounter the following error message: Zsh: Command not found: Laravel - PHP
. This error occurs when you try to execute a command that Zsh does not recognize.
In this article, we will discuss the possible causes of this error message and how to resolve it.
Laravel is not installed: If you have not installed Laravel on your system, Zsh will not recognize the command. You can install Laravel by following the instructions on the Laravel website.
Laravel's path is not set: If you have installed Laravel but have not set the path to the Laravel executable file, Zsh will not recognize the command. You can set the path by adding the following line to your .zshrc
file:
export PATH="$PATH:$HOME/.composer/vendor/bin"
To resolve the Zsh: Command not found: Laravel - PHP
error message, follow the steps below:
Check if Laravel is installed on your system by running the following command:
laravel --version
If Laravel is not installed, follow the installation instructions on the Laravel website.
If Laravel is installed, check if the path to the Laravel executable file is set by running the following command:
echo $PATH
The output should include the path to the Laravel executable file. If it does not, add the following line to your .zshrc
file:
export PATH="$PATH:$HOME/.composer/vendor/bin"
Save the .zshrc
file and close it.
Refresh the Zsh shell by running the following command:
source ~/.zshrc
Run the Laravel command again:
laravel --version
The output should show the version number of Laravel.
The Zsh: Command not found: Laravel - PHP
error message can be resolved by installing Laravel on your system and setting the path to the Laravel executable file. By following the steps outlined in this article, you should be able to fix this error and continue working with Laravel from your Zsh shell.