4

I'm new in lumen and i have done

composer clear-cache then after

composer update

to install some package after configurating composer.json however i have got this error:

[Composer\Downloader\TransportException]                                     
  The "http://packagist.org/p/phpunit/php-timer%24be3efc71adf134c858c1add0117  
  f060f4ab545fe9d357983c7bea165b2008d65.json" file could not be downloaded: p  
  hp_network_getaddresses: getaddrinfo failed: Name or service not known       
  failed to open stream: php_network_getaddresses: getaddrinfo failed: Name o  
  r service not known  

Plase how could i fix this error

DINA TAKLIT
  • 7,074
  • 10
  • 69
  • 74

5 Answers5

7

This issue was posted about 2 years ago but I wanna answer this problem so no one should have difficulty like me.

First open /etc/resolv.conf

(if you using Ubuntu distributions, the file is /etc/resolvconf/resolv.conf.d/head)

# cat /etc/resolve.conf

And after that, write this rows to the file:

# Google's public DNS servers
nameserver 8.8.8.8    # Primary DNS server
nameserver 8.8.4.4    # Secondary DNS server

These are the Google's public DNS servers as mentioned in the code above.

Save and close.

After restart the network service using this command:

service network restart

This solved my problem.

Hope help to others...

Arda Örkin
  • 121
  • 3
  • 8
2

I fixed the issue on Linux/Centos6 (Plesk Onyx) by:

Opening /etc/resolv.conf (my file was empty)

Added: nameserver 8.8.8.8 nameserver 8.8.4.4

options rotate options timeout:3

Hopefully this helps someone out there.

Rassoni
  • 19
  • 4
1

In my case was a dns misconfiguration in Vagrant VM.

Updating DNS in /etc/resolv.conf solved my issue: https://askubuntu.com/questions/897270/dns-cannot-resolve-hosts

hope this will help other users

lbrutti
  • 1,181
  • 13
  • 19
0

In case someone in the future needs this...

If you're using docker it's likely you're having DNS issues from inside the container. Basically the fix is :

Find out your network's DNS server :nmcli dev show | grep 'IP4.DNS' (let's say it gives 10.0.0.2)

then update /etc/docker/daemon.json like so :

{
    "dns": ["10.0.0.2", "8.8.8.8"]
}

of course replacing 10.0.0.2 with yours. Then don't forget to sudo service docker restart.

Jeremy Belolo
  • 4,319
  • 6
  • 44
  • 88
0

I tried using root user and it's working fine.

I was also facing the same error while installing few modules and also composer update.

Tried sudo su to login as root and ran composer command.

Ajay Gadhavana
  • 415
  • 5
  • 5