3

Flutter doctor gives server unavailable error
"Got socket error trying to find package node_preamble at https://pub.dartlang.org."

Installed Flutter for mac running BigSur and since then haven't been able to run it (pub get failed (server unavailable).
Tried using VPN but still no resolution.
Screenshot of the same -> https://i.stack.imgur.com/XpjTH.jpg

itz_ritz
  • 31
  • 1
  • 3

1 Answers1

0

You need to correctly set up your flutter path.

from here https://flutter.dev/docs/get-started/install/macos#update-your-path

Determine the directory where you placed the Flutter SDK. You will need this in Step 3. Open (or create) $HOME/.bash_profile. You can do that by using terminal text editor by going in terminal and typing nano ~/.bash_profile macOS Catalina uses the Z shell by default, so edit $HOME/.zshrc.

If you are using a different shell, the file path and filename will be different on your machine.

Add the following line and change [PATH_TO_FLUTTER_GIT_DIRECTORY] to be the path where you cloned Flutter’s git repo: export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH

for example:

export PATH=~/Documents/flutter/bin:$PATH

press CTRL X and when it asked you to save the file, choose yes

Run source $HOME/.bash_profile to refresh the current window or restart the terminal

Verify that the flutter/bin directory is now in your PATH by running: echo $PATH

Notice that [PATH_TO_FLUTTER_GIT_DIRECTORY] is where you installed flutter SDK, not the location of your app

Instead of nano, you can use any text editor to edit ~/.bash_profile

  • Hi @shekhobaba, I've already followed the steps and have flutter added to the path. The error still persists there. – itz_ritz Apr 02 '21 at 16:09