Run existing Laravel project with sail

Viewed 816

I have an existing Laravel project which I created with the following command.

curl -s https://laravel.build/example-app | bash

The project was created successfully and when I start it with command ./vendor/bin/sail up it works fine.

I want to clone the project on my second machine and start with sail. I found the following link from documentation which gives you possibility to run composer install even if you don't have composer installed on your OS.

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 basically starts a docker container which has php and composer installed and runs composer install.

Installing packages work fine, but whenever I run ./vendor/bin/sail up then it throws errors and the application is not started.

enter image description here It looks like some packages were not installed.

Has anyone had the same issue?

1 Answers

The problem is that you should update laravel/sail package first and then run composer install.

docker run --rm \
    -u "$(id -u):$(id -g)" \
    -v $(pwd):/var/www/html \
    -w /var/www/html \
    laravelsail/php81-composer:latest \
    composer update laravel/sail

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
Related