Skip to content
Advertisement

DNS resolver issue Composer 2

Composer version: 2.0.4

OS: macOS 10.15.7

When I run composer diagnose I get DNS resolver issue as seen in the attached image

I am able to ping getcomposer.org, packagist.org, github.com – all sites from the terminal.

curl -i packagist.org -L also works as expected without any error

Yet with composer diagnose I am getting DNS resolver issue

This started happening after I upgraded PHP from 7.4.1 to 7.4.12 and updating to composer 2

What could be the issue and how can I fix it

As searchable text code – composer 2.0.4 diagnose failing

JavaScript

Screenshot – composer 2.0.4 diagnose failing enter image description here

I just uninstalled composer 2.0.4 and installed composer 1.10.17 with rest of the packages/apps as it is and it runs without any DNS resolver error

As searchable text code composer 1.10.17 diagnose

JavaScript

Screenshot – composer 1.10.17 diagnose composer 2.0.4 diagnose failing

So does it mean that composer 2.0.4 has some issues? or is incompatible with my setup of other apps/packages?

I want to use composer 2.x, so what do I do to make it work?

Advertisement

Answer

In the end, it’s not a “composer” problem, but of the underlying connectivity technology. Composer 2 uses curl by default, whereas Composer 1 used PHP streams… and apparently they are not equally sensitive or forgiving to different network configurations and misconfigurations.

Some things to check and re-check:

  • Your DNS settings. Check that there are no wrongly configured entries. Just for the sake of it change if you can your DNS provider to a “known good” one. E.g. Cloudflare’s (1.1.1.1), or Google’s (8.8.8.8, 8.8.4.4), and remove all other entries.

  • IPV6 connectivity. You many need to disable it if you have it enabled, since some users reported issues with it.

  • Disable any VPNs you may be using to connect to the Internet, since they may interfere with your connectivity.

On this issue some users have commented on similar problems.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement