Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error while installing laravel installer in window 10

I am using Windows 10 and composer is installed. When I try to install laravel installer globally using this command:

composer global require laravel/installer

[Composer\Downloader\TransportException]
The "https://repo.packagist.org/packages.json" file could not be downloaded: 
failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

It means package not downloaded. I am not using any proxy server. Composer diagnose result is listed below:

Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: 
[Composer\Downloader\TransportException] The "http://repo.packagist.org/packages.json" file could not be downloaded: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Checking https connectivity to packagist: 
[Composer\Downloader\TransportException] The "https://repo.packagist.org/packages.json" file could not be downloaded: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] The 
"https://api.github.com/rate_limit" file could not be downloaded: failed to 
open stream: A connection attempt failed because the connected party did not 
properly respond after a period of time, or established connection failed 
because connected host has failed to respond.

Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952 OK
Checking composer version: OK
Composer version: 1.8.0
PHP version: 7.2.1
PHP binary path: E:\xampp\php\php.exe
like image 797
Gurpal singh Avatar asked Dec 31 '18 09:12

Gurpal singh


People also ask

How to install Laravel on Windows 10?

In Laravel, it is required to install packages and Laravel itself. You can download and install Composer free from Download composer for Windows 10 Once the above requirements are completed then you can install Laravel by running below command on your cmd.

How to install Laravel in Visual Studio 2022?

Go to the Microsoft Visual Studio’s official website. Now, go to the “All Downloads” section below and click “Other Tools, Frameworks, and Redistributables” and then download and install Microsoft Visual C++ Redistributable for Visual Studio 2022. Composer is another mandatory requirement for Laravel installation.

How do I open a Laravel project in terminal?

Once these tools are installed, you may open any Laravel project by executing the code . command from your application's root directory using Windows Terminal. If you're developing on Linux and Docker Compose is already installed, you can use a simple terminal command to create a new Laravel project.

How do I create a Laravel project in WSL2 Linux?

Launch Windows Terminal and begin a new terminal session for your WSL2 Linux operating system. Next, you can use a simple terminal command to create a new Laravel project. For example, to create a new Laravel application in a directory named "example-app", you may run the following command in your terminal:


3 Answers

To resolve this, configure composer to use the https repository by running the following command on the cli before installing Laravel

composer config -g repo.packagist composer https://packagist.org
like image 103
Udo E. Avatar answered Oct 17 '22 11:10

Udo E.


The following steps will fix most "packages.json file could not be downloaded" issue with Composer:

  1. Verify your firewall setting. Disable Firewall for starters
  2. Enable PHP OpenSSL Extension
  3. Enable PHP allow_url_fopen directive

Note: Make sure you are working with the right PHP version and Environment (apache, CLI, etc.) when you modify the php.ini file.

like image 26
Solomon A. Avatar answered Oct 17 '22 12:10

Solomon A.


Do you use any antivirus? If yes try to disable then check.

Sometime Mcafe prevent to download packagist.

like image 3
vijay narang Avatar answered Oct 17 '22 11:10

vijay narang