Shashank Shinde
Shashank Shinde

Reputation: 389

Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds

Log:

E:\Flutter>flutter doctor Checking Dart SDK version... Downloading Dart SDK from Flutter engine ead227f a... Unzipping Dart SDK... Updating flutter tool... Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...

Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...

Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...

Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...

Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...

Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...

enter image description here

Upvotes: 29

Views: 73471

Answers (30)

Miguel Gamboa
Miguel Gamboa

Reputation: 9393

For Mac users. In my case just worked after doing it with privileges:

sudo -s
dart pub cache repair  

And them again:

sudo chown -R $(whoami) /Users/miguelgamboa/.pub-cache

Upvotes: 1

Mahesh Jamdade
Mahesh Jamdade

Reputation: 20369

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

Upvotes: 45

Antonin GAVREL
Antonin GAVREL

Reputation: 11259

I had removed access to the certificates while setting up a proxy with Postman:

enter image description here

run sudo dpkg-reconfigure ca-certificates and enter space to select again (star)

Upvotes: 0

bgtiban
bgtiban

Reputation: 1

I got the same problem, with the following steps I solved them:

sudo snap remove flutter --purge
sudo snap install flutter
sudo flutter upgrade

Upvotes: 0

Ojara Godwin
Ojara Godwin

Reputation: 1

For my case, i was using ubuntu, and after reading the above comments, i have come to a resolution that the above error comes as a result of permissions being blocked, accessing cmd with admin access levels solves the problem, e.g on linux run sudo flutter doctor and the problem will be solved. This error occured to me when i tried upgrading my flutter so it needed admin rights to be upgraded nothing much

Upvotes: 0

Yigit Arslan Yasar
Yigit Arslan Yasar

Reputation: 1

Mac auto iCloud upload might be causing the error

If you are using Mac and if your Desktop files are being uploaded to iCloud automatically, sometimes iCloud uploads the "bin" file or the "cache" file inside the flutter file. I've just downloaded the file onto desktop (right click the file -> "Download Now") and it downloaded the file, it ran as usual. (Automatic upload can be turned off from system preferences if youn are getting this error frequently like I was).

Upvotes: 0

Martyn Wright
Martyn Wright

Reputation: 11

Tried all of the above without success. The search order in the PATH system variable turned out to be the problem:

it was:

    G:\My Drive\Compilers\flutter\bin;
    G:\My Drive\Compilers\flutter\bin\flutter;
    G:\My Drive\Compilers\flutter\bin\flutter.bat;
    G:\My Drive\Compilers\flutter\bin\dart.exe;
    G:\My Drive\Compilers\flutter\bin\dart;
    G:\My Drive\Compilers\flutter\bin\dart.bat;

changed it to:

    G:\My Drive\Compilers\flutter\bin\flutter
    G:\My Drive\Compilers\flutter\bin\flutter.bat
    G:\My Drive\Compilers\flutter\bin\dart
    G:\My Drive\Compilers\flutter\bin\dart.bat

that fixed it

Upvotes: 0

Vasanth Korada
Vasanth Korada

Reputation: 467

  1. Delete cache directory in flutter/bin
  2. Then run flutter doctor

Upvotes: 2

Chanaka
Chanaka

Reputation: 471

I had the same issue with my MacBook M1. I tried deleting and running flutter pub cache repair But It didn't work for me.

Then I ran the command softwareupdate --install-rosetta and accepted the software licences & agreement (After installing XCode). Now the command flutter works fine. :)

Upvotes: 0

Ayush Mandowara
Ayush Mandowara

Reputation: 500

Source of Problem

It might be possible that you don't have enough free disk space. That's what caused my problems to begin with.

Solution

In my case,

  • First I had to clean up space to remove any unused files.
  • Then I had to overwrite the flutter SDK folder due to corruption. The SDK can be found here.

Upvotes: 0

Ahmed Darwish
Ahmed Darwish

Reputation: 11

I had the same problem and it was solved.

Steps:

Download Dart and Filters SDK then Decompress these files and move them to this directory.

C: \ Define the variables in path:

Upvotes: 1

Anatolii Kosorukov
Anatolii Kosorukov

Reputation: 960

I fix 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.

After that I run flutter doctor and get predictable results:

e:\tools>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version
    6.1.7601], locale ru-RU)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)

[√] Android Studio (version 3.6)
[!] IntelliJ IDEA Community Edition (version 2019.2)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Ultimate Edition (version 2019.2)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.44.2)
[√] Connected device (1 available)

! Doctor found issues in 2 categories.

Upvotes: 17

Andre.L
Andre.L

Reputation: 46

Tried switch to Dev channel and got stuck with "Unable to pub upgrade". Did everything and nothing worked.

This is what I did:

  • Renamed the Flutter SDK folder
  • Download the latest Flutter SDK
  • Extract to the same location of previous renamed SDK
  • Flutter channel Dev
  • Flutter upgrade

And everything back to normal.

Upvotes: 0

darshan Savaj
darshan Savaj

Reputation: 1

Pub failed to delete entry because it was in use by another process. This may be caused by a virus scanner or having a file in the directory open in another application. Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)

Upvotes: 0

ANDYNVT
ANDYNVT

Reputation: 671

If anyone faces this problem on macOS with AdGuard installed. Try this:

Go AdGuard Preferences -> Network -> Automatically filter applications -> Select Mode... and change mode to Automatic Proxy.

Upvotes: 1

Jayashree Prasad
Jayashree Prasad

Reputation: 1

You get the error -- "Pub failed to delete entry because it was in use by another process. This may be caused by a virus scanner or having a file in the directory open in another application. Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (1 tries left)" even if you are in one of the flutter directories from Windows explorer. Close the window and try running Flutter doctor. This will resolve.

Upvotes: 0

iamwent
iamwent

Reputation: 111

I updated the flutter SDK via git pull, then the flutter doctor command works.

Upvotes: 3

Ronnie Tws
Ronnie Tws

Reputation: 484

Solved this issue when Run the CMD as administrative.

Upvotes: 5

Pathik Patel
Pathik Patel

Reputation: 1510

I found my antivirus blocks pub upgrade,I had same issue while hitting flutter doctor, I turned off my antivirus and tried to run "flutter doctor" again, and worked well!

Upvotes: 14

Hitesh Dhamshaniya
Hitesh Dhamshaniya

Reputation: 2182

In my case, the error resolve after adding below folder into exclude option in anti virus

Flutter SDK location D:\Android\flutter_windows\flutter\*.

Flutter Local Pub folder C:\Users\hitesh\AppData\Local\Pub

Upvotes: 0

S4beR
S4beR

Reputation: 1847

If you are using Avast (or possibly some other anti virus too) on Mac and have recently updated the OS to Big Sur then follow the below steps to fix this issue

  1. Open Avast and in the Web Shield area disable the "Scan secure connection".
  2. Run flutter config --no-analytics and then run pub upgrade.

This should probably fix the issue.

You can also refer to below threads in Github for more details about the cause

https://github.com/flutter/flutter/issues/40515

https://github.com/flutter/flutter/issues/68999

Upvotes: 0

Márcio Ramos
Márcio Ramos

Reputation: 11

It seems it is not being able to "unzip" the downloaded Dart file because it misses 7-zip uncompressor. I installed it and it worked! It will deal with .7z files. I hope it works for other people too!!

Upvotes: 1

Komal Dewnani
Komal Dewnani

Reputation: 225

I deactivated my antivirus for some time and executed flutter doctor command once again in cmd and got fruitful results after hours of patience. One more thing to note, you should ensure that path of dart-sdk folder should be added to the path in user variables.

Upvotes: 1

heimzza
heimzza

Reputation: 286

Manually downloading the SDK from flutter website fixed the issue.

Still dont know why this problem occured tho.

Upvotes: 0

Ebrand Managers
Ebrand Managers

Reputation: 31

Just Deactivate your antivirus and run it again. It would work fine. I had the same issue before.

Upvotes: 1

Vijay Patil
Vijay Patil

Reputation: 1

I got the same error and was not able to get rid of it. So I deleted the flutter and instead of cloning it I downloaded the zip from the flutter website and extracted it. Now it works just fine.

Upvotes: 0

giorgio79
giorgio79

Reputation: 4209

I had to turn off the Android Emulator. It was running for me...

Upvotes: 0

Rishi Chhabra
Rishi Chhabra

Reputation: 101

Just delete the cache folder in flutter/bin and run flutter doctor again!!

Upvotes: 1

Blasanka
Blasanka

Reputation: 22467

Strangly when I kill the dart process in Windows Task Manager it is working. But sometimes even when dart process is running update working.

Upvotes: 0

user12775640
user12775640

Reputation: 1

Check your flutter bin path in environment variable(User Variables). If not go to Under User variables check if there is an entry called Path:in that add this flutter/bin path.

Upvotes: 0

Related Questions