Flutter pub.get stopped working, even on vanilla install : socket error trying to find package xxx

1,449

Solution 1

As I was about to format my HD, I uninstalled SOPHOS HOME antivirus, and it solved the issue.

This is weird because another Mac computer running the same OS and the same Sophos version worked like a charm.

Solution 2

A socket error is basically a connection error. And in the case of running flutter pub get a socket error is very likely due to a firewall. Check your firewall settings. Ensure that no component of Flutter, Dart, or your IDE is being blocked by your firewall or antivirus program.

I encountered the same problem and found out that dart.exe was denied network permission by my firewall. After putting dart.exe on the exceptions list the problem was solved.

Share:
1,449
Serge B.
Author by

Serge B.

Updated on December 19, 2022

Comments

  • Serge B.
    Serge B. over 1 year

    First of all, I have been working with Flutter for more than 3 years, and am a reasonably seasoned dev. Yet this baffles me, and I can’t find a solution online.

    Since this morning, I systematically get this error while running flutter pub get ou flutter doctor

    pub get failed (server unavailable) -- attempting retry 1 in 1 second... Got socket error trying to find package node_preamble at https://pub.dartlang.org

    I am on Big Sur 11.2.2 I wiped the Flutter sdk dir, reinstalled from the official site (latest stable), wiped the .pub-cache and removed a stand-alone dart install. Rebooted several times. Yet, I still get the problem on the first ‘Flutter doctor’ I also manually installed the node_preamble packages, without result.

    Here and there, I find mentions of a problem with proxies but I have none and reproduced the issue using my phone’s 4g connection. I also deactivated the antivirus and went as far as using a VPN to try France and USA (I am based in Belgium).

    Am I the only one ? Do you have any clue? I would love to supply a Flutter doctor, but I can’t. And I am badly stuck now :/ Thanks