phplaravelcomposer-php

Laravel command not found. But it is added to my $PATH on Ubuntu


So I know there are alot of simmular issues but none if them are exactly the same,

I want to start my first laravel project but, my terminal tells me command not found,

I installed composer from the website and when I run composer I can see that it works perfectally with no issue, when running composer global require "laravel/installer" I get this in response :

Info from https://repo.packagist.org: #StandWithUkraine
Using version ^4.2 for laravel/installer
./composer.json has been updated
Running composer update laravel/installer
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
9 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

This tells me that laravel is indeed installed but has not updates but when I run command laravel the response is laravel: command not found,

I have added composer to my $PATH already.

This is why I am posting this issue because all the posts I find says to add composer to your $PATH but mine is already but its still a issue.

PHP is also installed on my machine

I am running linux Ubuntu 22.04 LTS


Solution

  • I'll write the answer here so you can close the question. As @geertjanknapen said in the comment if you can install your project the run

    composer create-project laravel/laravel your-app-name
    cd /your-app-name
    php artisan serve
    

    You must have a local server running also, once you have run php artisan serve then just go to http://127.0.0.1:8000/ and you'll see Laravel's home screen. (NOTE 8000 is the default port, so put yours there if you've changed it).