G H Prakash
G H Prakash

Reputation: 1857

Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)

I am trying for flutter doctor and the following error was shown

Running pub upgrade...
The system cannot find the path specified.
Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)

Waiting for 2 seconds, press CTRL+C to quit ...
Terminate batch job (Y/N)?

enter image description here

the above initializing was shown for 4 hours. What may be the issue? Can anyone please help with this

Upvotes: 4

Views: 5875

Answers (4)

Yuvraj Desai
Yuvraj Desai

Reputation: 285

I fixed that by:

  1. Ctrl+C to stop infinite error loop.
  2. Kill the Dart process in Windows Task Manager.
  3. Delete the cache folder located in flutter/bin directory.
  4. Run in command line flutter pub cache repair.
  5. Run flutter doctor

Upvotes: 4

Jan Bodnar
Jan Bodnar

Reputation: 11637

The flutter tool is fundamentally broken. It cannot reliably do an upgrade. It is a mix of Bash, BAT & Powershell scripts, which are very cryptic and fragile. They can fail due to various reasons, including permissions, bad internet connection, disk space etc. The scripts fail to provide meaningful error messages. What on earth is The system cannot find the path specified.? What path? Then they run an endless loop trying to somehow magically 'fix' the issue.

To avoid these issues, download the full Flutter SDK to a chosen directory, unzip it, and update the PATH accordingly yourself. The Flutter SDK contains also the Dart SDK.

Also one gotcha. If you have multiple Flutter installations, be sure to run the flutter from outside the bin directory like so: bin\flutter doctor. You may accidentally run flutter from a different location.

Upvotes: 0

Aravind Aji
Aravind Aji

Reputation: 154

First Make sure you have a working internet connection and if this issue still exists then, this error may be because the dart SDK may have not been properly downloaded. The simplest solution is to delete the cache folder located in the flutter/bin(the location where the flutter is installed) and then Run the flutter doctor.

**Also **try turning off your 'Antivirus' and try 'flutter doctor'

Upvotes: 0

Ravindra S. Patil
Ravindra S. Patil

Reputation: 14775

Try below steps hope its help to you:

  1. Go to your flutter directory
  2. Delete cache folder inside flutter/bin directory
  3. Then try to run flutter doctor

Upvotes: 1

Related Questions