[SOLVED] Running a laravel 9 project cloned from github

Issue

This Content is from Stack Overflow. Question asked by Asish Antony

I have cloned a laravel 9 project which is working in the System it created.
The laravel project uses sail to run the project in PHP 8. I am not able to run the local version in the system where I cloned the project.
I tried the following code as per the documentation

docker run --rm 
    -u "$(id -u):$(id -g)" 
    -v $(pwd):/var/www/html 
    -w /var/www/html 
    laravelsail/php81-composer:latest 
    composer install --ignore-platform-reqs

This gives an error telling a composer.json is not found

I have then tried docker compose up

and it fails at the first building phase

My PHP version is 7.4 but I need PHP 8 in the container to run laravel 9

Can anyone explain how I can run git cloned dockerized laravel 9



Solution

double check if composer.json is there it must be since it contains all the configuration packages, dependencies, etc.
Once you find it run the following commands on the
terminal:

  1. composer install
  2. composer update -o –optimize-autoloader
  3. composer dump-autoload -o –optimize

Be sure to not get any dependency error and/or version conflicts and finally run:

php artisan serve, so the app runs in localhost:8000


This Question was asked in StackOverflow by Asish Antony and Answered by jmvcollaborator It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?