Sandeep Chatterjee
Sandeep Chatterjee

Reputation: 3249

Connection refused while downloading Laravel installer - "https://repo.packagist.org/packages.json" file could not be downloaded"

I am trying to download the Laravel installer using Composer for the first time on Ubuntu 20.04 LTS.

composer global require laravel/installer

gives

Changed current directory to /home/sandeep/.config/composer

In RemoteFilesystem.php line 560:
                                                                                                           
  The "https://repo.packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection refused

                                                                                      

PHP Version:

PHP 7.4.3 (cli) (built: May 26 2020 12:24:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

Composer Version

Composer 1.10.1 2020-03-13 20:34:27  

Ping Output:

sandeep@sandeep:~$ ping repo.packagist.org
PING org.domain.name (78.47.226.171) 56(84) bytes of data.
64 bytes from static.171.226.47.78.clients.your-server.de (78.47.226.171): icmp_seq=1 ttl=49 time=251 ms
64 bytes from static.171.226.47.78.clients.your-server.de (78.47.226.171): icmp_seq=2 ttl=49 time=251 ms
64 bytes from static.171.226.47.78.clients.your-server.de (78.47.226.171): icmp_seq=3 ttl=49 time=251 ms
64 bytes from static.171.226.47.78.clients.your-server.de (78.47.226.171): icmp_seq=4 ttl=49 time=251 ms
64 bytes from static.171.226.47.78.clients.your-server.de (78.47.226.171): icmp_seq=5 ttl=49 time=251 ms
^C
--- org.domain.name ping statistics ---
6 packets transmitted, 5 received, 16.6667% packet loss, time 5007ms
rtt min/avg/max/mdev = 250.508/250.803/251.168/0.231 ms

Not sure if this is a configuration or a network issue or something else.

Upvotes: 1

Views: 2902

Answers (1)

Sandeep Chatterjee
Sandeep Chatterjee

Reputation: 3249

It was a network issue.

I had to modify /etc/resolv.conf

sudo vim /etc/resolv.conf

and add

nameserver 8.8.8.8
nameserver 8.8.4.4

Save the file and restart the network.

Upvotes: 1

Related Questions