network is fine, but cannot create laravel project and show error in the command

1.7k views Asked by At

I used this command to create a new laravel project in the homestead:

composer create-project laravel/laravel Laravel

Then, the terminal show this error:

Failed to download laravel/laravel from dist: The "https://api.github.com/repos/laravel/laravel/zipball/7bddbdc2a1f8d9c23205707e74455d74684e3031" file could not be downloaded: failed to open stream: Connection timed out Now trying to download from source

I used curl command to get the content, failed again:

curl https://api.github.com/repos/laravel/laravel/zipball/7bddbdc2a1f8d9c23205707e74455d74684e3031

However, when I enter the address in the broswer(Firefox), it work! I can download the file by the browser!

Any help is greatly appreciated.

1

There are 1 answers

5
Limon Monte On

This is probably the common issue about the reliability of the github downloads. It fails regularly.

A workaround is to increase COMPOSER_PROCESS_TIMEOUT (defaults to 300) and force installing from source with the --prefer-source option:

COMPOSER_PROCESS_TIMEOUT=2000

composer create-project laravel/laravel Laravel --prefer-source