Make sure you are in the project root directory
One of the common mistakes that user faces when running the "artisan" command is getting this error and the main cause is that they are not within the project root directory. So whenever you are running this command, you need to be in the project root directory where the "artisan" executable is placed on.
Make artisan executable
Another possible way to fix this error is to make the "artisan" executable if it's not already. To update this you can run the chmod command and it will be like below.
chmod +x artisan