Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to 'pub upgrade' flutter tool. #12666

Closed
09abhishek opened this issue Oct 21, 2017 · 111 comments · Fixed by #14907
Closed

Unable to 'pub upgrade' flutter tool. #12666

09abhishek opened this issue Oct 21, 2017 · 111 comments · Fixed by #14907

Comments

@09abhishek
Copy link

@09abhishek 09abhishek commented Oct 21, 2017

Guys Please help me!!

C:\Users\git>flutter doctor
Updating flutter tool...
The system cannot find the path specified.
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...

Waiting for 0 seconds, press CTRL+C to quit ...
The system cannot find the path specified.
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...

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

version of PowerShell do you have on your system :

image

To know which code path gets triggered in the system
Get-Command 7z
Get-Command Expand-Archive

image

image

@Hixie

This comment has been minimized.

Copy link
Contributor

@Hixie Hixie commented Oct 24, 2017

@goderbauer any ideas?

@goderbauer

This comment has been minimized.

Copy link
Member

@goderbauer goderbauer commented Oct 24, 2017

@09abhishek You should probably consider updating your PowerShell. Version 2 is very old. It should still work with flutter, though.

In your flutter dir, does the following file exist? bin\cache\dart-sdk\bin\pub.bat?

Can you cd into flutter\packages\flutter_tools and in there execute ..\..\bin\cache\dart-sdk\bin\pub.bat upgrade --verbosity=error --no-packages-dir. What does that get you?

@09abhishek

This comment has been minimized.

Copy link
Author

@09abhishek 09abhishek commented Oct 25, 2017

@goderbauer
@Hixie
No .. There is nothing, any file like pub.bat at the mentioned path!

image

image

@goderbauer

This comment has been minimized.

Copy link
Member

@goderbauer goderbauer commented Oct 25, 2017

Looks like something went wrong while downloading the dart sdk. Can you delete the cache folder inside bin and then run flutter doctor again? What's the output?

Are you by any chance behind a firewall (or using a proxy) that might be blocking the download of the dart sdk?

@09abhishek

This comment has been minimized.

Copy link
Author

@09abhishek 09abhishek commented Oct 27, 2017

@goderbauer ... Thanks for your assistance Issue got fixed!! Thanks!!

@09abhishek 09abhishek closed this Oct 27, 2017
@NathanaelA

This comment has been minimized.

Copy link

@NathanaelA NathanaelA commented Nov 11, 2017

Is there any manual instructions on this; I've tried three times now; I have the exact same output @09abhishek. I'm running windows 7; so also powershell 2. Have 7z installed; tried killing the cache; tried a fresh re-install in another folder. BITS shows it downloaded (i.e. the progress bar goes across). But the dart-sdk is empty.

@09abhishek - What did you do to fix it?

@09abhishek

This comment has been minimized.

Copy link
Author

@09abhishek 09abhishek commented Nov 11, 2017

@NathanaelA Hi, please share the screenshot of the download path of dart-sdk, So, I could help you in better way!

@09abhishek 09abhishek reopened this Nov 11, 2017
@NathanaelA

This comment has been minimized.

Copy link

@NathanaelA NathanaelA commented Nov 11, 2017

Download PATH's that I tried:
d:\projects\flutter
and
c:\progra~1\flutter (Unlocked security on folder to allow writes by user)
and
c:\android\flutter

Both were full checkouts of the alpha folder via git.

However, I believe I have it fixed. But for anyone else that runs into this:

I was able to fix it by MOVING the download and extracted data from
C:\progra~1\flutter\bin\$cachePath to C:\progra~1\flutter\bin\cache
Then manually running the instructions that Michael put in above:

"
Can you cd into flutter\packages\flutter_tools and in there execute ..\..\bin\cache\dart-sdk\bin\pub.bat upgrade --verbosity=error --no-packages-dir . What does that get you?
"

After that point flutter doctor appears to be working correctly and it appears to be downloading the rest of the needed items. Yay!

--
Small Update: I've since this time moved everything to C:\android\flutter; do to some weird issues with paths that have spaces in it breaking some of the android tools. But even that path has had the same flutter upgrade issue.

@09abhishek

This comment has been minimized.

Copy link
Author

@09abhishek 09abhishek commented Nov 11, 2017

@NathanaelA so, the issue got sorted out ..right??
just in case if you still facing any error try to delete the "cache" folder :
image

and $cachePath :

image

and try to run flutter doctor again..

and most probably after doing this Flutter's "Doctor" would run without any exceptions!! :-p

@09abhishek 09abhishek closed this Nov 11, 2017
@NathanaelA

This comment has been minimized.

Copy link

@NathanaelA NathanaelA commented Nov 12, 2017

I actually tried deleting both cache & $cachePath, and it didn't fix it. The third time when it didn't work; I decided to see what was in those folders; cache (which was empty) and $cachePath which had the items that seems to be indicated in the above thread (i.e. pub.bat, dart-sdk, etc). So I manually went in that folder and ran dart and it ran; so it made it obvious it was all extracted just in the wrong location.

Decided what the hell, move everything from $cachePath to cache and then try the above pub line, and it worked. flutter doctor just finished and gave me the green light. So I believe I am up.


So basically if you get the finding pub error in a loop;

Updating flutter tool...
The system cannot find the path specified.
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...

Waiting for 0 seconds, press CTRL+C to quit ...
The system cannot find the path specified.
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...

cancel the script; see if everything got extracted in the $cachePath folder -- then move everything in the cache folder, and follow Michael's instructions:
"
Can you cd into flutter\packages\flutter_tools and in there execute ....\bin\cache\dart-sdk\bin\pub.bat upgrade --verbosity=error --no-packages-dir . What does that get you?
"

Then you should be able to type flutter doctor and it should finish installing everything properly.

@Gyanig

This comment has been minimized.

Copy link

@Gyanig Gyanig commented Feb 23, 2018

Checking Dart SDK version...
Downloading Dart SDK from Flutter engine ead227f...
Unzipping Dart SDK...
Updating flutter tool...
Handshake error in client (OS Error:
CERTIFICATE_VERIFY_FAILED: self signed certificate in certificate chain(ssl_cert.c:345))
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...

Waiting for 0 seconds, press CTRL+C to quit ...

what should i do??

@dd10-e

This comment has been minimized.

Copy link

@dd10-e dd10-e commented Feb 24, 2018

Same error =/

I'm on Windows 10 Version 10.0.16299 Numéro 16299 (Fall Creators Update) with Powershell 5.1.
I have already deleted cache folder.

@NathanaelA

This comment has been minimized.

Copy link

@NathanaelA NathanaelA commented Feb 24, 2018

@Hixie & @goderbauer - This should probably be re-opened. I ran into it again last week, when doing an update. I confess I don't do the flutter upgrades very often, so far each upgrade that I've done I've ran into this. ;-( I'd be willing to do whatever tests you need to help you track this down as this is very bad for onboarding new users.

@EloD10 See my instructions above; basically on some machines it seems to extract all the stuff to the $cachePath folder instead of the Cache folder and then breaks. I honestly don't know if the extraction is occurring in the wrong location; or if it is failing to move the files.

But on my last update; I again had to nuke both the cache and cachepath folders; then attempt to do the upgrade -> it downloads everything and then goes into the same endless loop. Ctrl-C cancel, then manually move the files like I did in the instructions above and then everything finished properly.

@dd10-e

This comment has been minimized.

Copy link

@dd10-e dd10-e commented Feb 24, 2018

Hey @NathanaelA, thanks for response !

I have follow your instructions as suggest above :

Can you cd into flutter\packages\flutter_tools and in there execute ....\bin\cache\dart-sdk\bin\pub.bat upgrade --verbosity=error --no-packages-dir . What does that get you?

It geave me nothing. No message.

I the only folder i have, is cache folder, i can't find $cachePath in flutter\bin or whatever. =/
In cache folder, i can see only that : https://imgur.com/qkeaqBE

I don't know what i suppose to do, =/

@NathanaelA

This comment has been minimized.

Copy link

@NathanaelA NathanaelA commented Feb 24, 2018

Ok, in pictures: I just did another upgrade and of course it failed as usual.

C:\Android\flutter>flutter upgrade
Checking Dart SDK version...
Downloading Dart SDK from Flutter engine ead227f118077d1f2b57842a32abaf105b573b8a...
Unzipping Dart SDK...
Updating flutter tool...
The system cannot find the path specified.
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...

Waiting for 0 seconds, press CTRL+C to quit ...
The system cannot find the path specified.
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...

So I cancel it via CTRL-C.

Next open up explorer and navigate to my flutter folder and I see this:

image

In the root flutter directory; there is a $cachePath folder. Inside this folder is the dart-sdk, and inside the dart-sdk is all the files that I expect to exist.
In the root flutter directory there is also a bin folder, inside the bin folder is a EMPTY $cachePath folder and a cache folder. Inside the cache folder there is a empty dart-sdk folder.

So my solution so far has been to MOVE the flutter\$cachePath\dart-sdk folder to flutter\bin\cache\dart-sdk

And then type flutter upgrade again.


One note; I have once before had to delete both of the $cachePath folders and the cache folder, then do a upgrade (which redownloads what I need into the root $cachePath folder) ; then move the files and do another upgrade. But I haven't seen that issue in a while.

@dd10-e

This comment has been minimized.

Copy link

@dd10-e dd10-e commented Feb 25, 2018

The problem is that i haven't any $cachePath folder.
image

One note, i haven't this line The system cannot find the path specified. :

Checking Dart SDK version...
Downloading Dart SDK from Flutter engine ead227f118077d1f2b57842a32abaf105b573b8a...
Unzipping Dart SDK...
Updating flutter tool...
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...
@NathanaelA

This comment has been minimized.

Copy link

@NathanaelA NathanaelA commented Feb 25, 2018

@EloD10 -

  1. What is the full path to your Flutter.
  2. Is their a pub.bat file in the flutter\bin\cache\dart-sdk\bin folder?
@dd10-e

This comment has been minimized.

Copy link

@dd10-e dd10-e commented Feb 25, 2018

@NathanaelA

My full path to flutter is : C:\LabMobile\flutter
And in the flutter\bin\cache\dart-sdk\bin direction, i have pub.bat

@NathanaelA

This comment has been minimized.

Copy link

@NathanaelA NathanaelA commented Feb 25, 2018

A couple more things
What does flutter channel say?

Can you also try doing this from a command prompt:
cd \LabMobile\flutter\packages\flutter_tools
then
..\..\bin\cache\dart-sdk\bin\pub.bat upgrade --verbosity=warning --no-packages-dir

And it should print stuff. See if there are any errors.

@dd10-e

This comment has been minimized.

Copy link

@dd10-e dd10-e commented Feb 25, 2018

By calling the command flutter channel, it tries to update flutter tool as the command flutter doctor does.

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

Same thing by calling flutter only.

Can you also try doing this from a command prompt:
cd \LabMobile\flutter\packages\flutter_tools
then
....\bin\cache\dart-sdk\bin\pub.bat upgrade --verbosity=warning --no-packages-dir

And it should print stuff. See if there are any errors.

This give me absoluly nothing.
I can't understand what is wrong, whereas i have clone the branch mention in Get Starting guide of flutter.io website: git clone -b dev https://github.com/flutter/flutter.git

@NathanaelA

This comment has been minimized.

Copy link

@NathanaelA NathanaelA commented Feb 25, 2018

  1. Ah, yeah; try a git status in the flutter directory to see what branch you are on. You want to be either on "dev" or "master", dev is more stable; master is well the latest master.

  2. You can try ..\..\bin\cache\dart-sdk\bin\pub.bat upgrade --verbosity=all --no-packages-dir and see if it prints anything. When I used "all" I got a LOT of output.

  3. Have you tried deleting the "bin\cache" directory; and then doing a flutter upgrade

@dd10-e

This comment has been minimized.

Copy link

@dd10-e dd10-e commented Feb 25, 2018

It's my output with your second instruction :

FINE: Pub 2.0.0-edge.0d5cf900b021bf5c9fa593ffa12b15bcd1cc5fe0
IO  : Spawning "cmd /c ver" in C:\LabMobile\flutter\packages\flutter_tools\.
IO  : Finished ver. Exit code 0.
    | stdout:
    | |
    | | Microsoft Windows [version 10.0.16299.248]
    | Nothing output on stderr.
MSG : Resolving dependencies...
SLVR: Solving dependencies:
    | - coverage 0.10.0 from hosted (coverage)
    | - test 0.12.30+4 from hosted (test)
    | - file 2.3.6 from hosted (file)
    | - mustache 1.0.0 from hosted (mustache)
    | - meta 1.1.2 from hosted (meta)
    | - web_socket_channel 1.0.7 from hosted (web_socket_channel)
    | - http 0.11.3+16 from hosted (http)
    | - xml 2.6.0 from hosted (xml)
    | - json_rpc_2 2.0.7 from hosted (json_rpc_2)
    | - stream_channel 1.6.3 from hosted (stream_channel)
    | - process 2.0.7 from hosted (process)
    | - vm_service_client 0.2.4+1 from hosted (vm_service_client)
    | - front_end any from hosted (front_end)
    | - linter 0.1.43 from hosted (linter)
    | - quiver 0.28.0 from hosted (quiver)
    | - args 1.3.0 from hosted (args)
    | - package_config 1.0.3 from hosted (package_config)
    | - crypto 2.0.2+1 from hosted (crypto)
    | - platform 2.1.2 from hosted (platform)
    | - plugin 0.2.0+2 from hosted (plugin)
    | - stack_trace 1.9.1 from hosted (stack_trace)
    | - usage 3.3.0 from hosted (usage)
    | - intl 0.15.2 from hosted (intl)
    | - archive 1.0.33 from hosted (archive)
    | - cli_util 0.1.2+1 from hosted (cli_util)
    | - json_schema 1.0.8 from hosted (json_schema)
    | - yaml 2.1.13 from hosted (yaml)
    | - analyzer any from hosted (analyzer)
IO  : Get versions from https://pub.dartlang.org/api/packages/coverage.
IO  : HTTP GET https://pub.dartlang.org/api/packages/coverage
    | Accept: application/vnd.pub.v2+json
    | X-Pub-OS: windows
    | X-Pub-Command: upgrade
    | X-Pub-Session-ID: 6F88456D-F133-464D-8224-E1991D4CBFED
    | X-Pub-Reason: direct
    | user-agent: Dart pub 2.0.0-edge.0d5cf900b021bf5c9fa593ffa12b15bcd1cc5fe0
IO  : HTTP response 200 OK for GET https://pub.dartlang.org/api/packages/coverage
    | took 0:00:00.443474
    | transfer-encoding: chunked
    | date: Sun, 25 Feb 2018 18:53:20 GMT
    | content-encoding: gzip
    | vary: Accept-Encoding
    | via: 1.1 google
    | content-type: application/json
    | x-frame-options: SAMEORIGIN
    | x-xss-protection: 1; mode=block
    | x-content-type-options: nosniff
    | server: dart:io with Shelf

But always the same error, even if i deleting bin\cache directory, and always not $cachePath folder =/

@NathanaelA

This comment has been minimized.

Copy link

@NathanaelA NathanaelA commented Feb 25, 2018

@EloD10 - I think you are running into a different issue than this issue. Was their any more output; because my output scrolled for pages and pages of data.

Your dart-sdk is being installed correctly but something else is going wrong. Your issue might be related to #12341 ; are you running any virus checkers; you can try to temporarily disable it and see if the upgrade works.

One other option; is nuke the flutter directory and do a fresh checkout of the "dev" branch..

@dd10-e

This comment has been minimized.

Copy link

@dd10-e dd10-e commented Feb 25, 2018

I tried all suggestion but no results, i will experiment. I'll keep you posted!

@sankarbc

This comment has been minimized.

Copy link

@sankarbc sankarbc commented Mar 26, 2018

issue: git clone -b beta https://github.com/flutter/flutter.git

*beta to master : run in windows command prompt

similarly follow this flutter installation guide

its work for me ............

@Leisser

This comment has been minimized.

Copy link

@Leisser Leisser commented Aug 14, 2018

Hello am in Uganda. socked into flutter but got this error about a week ego, till now no progress

cm

@zoechi

This comment has been minimized.

Copy link
Contributor

@zoechi zoechi commented Aug 22, 2018

@Leisser I'd expect this to be a temporary issue with pub.dartlang.org.
Do you still see this?

@Leisser

This comment has been minimized.

Copy link

@Leisser Leisser commented Aug 22, 2018

Thanks @zoechi, it's solved. The problem is the government restrictions on internet usage so somehow some packages can't be reached. I think this also strongly explains why flutter users in china are getting the same problems

@Leisser

This comment has been minimized.

Copy link

@Leisser Leisser commented Aug 22, 2018

@mit-mit

This comment has been minimized.

Copy link
Member

@mit-mit mit-mit commented Aug 22, 2018

For Flutter in China, please see https://github.com/flutter/flutter/wiki/Using-Flutter-in-China

@ScottS2017

This comment has been minimized.

Copy link

@ScottS2017 ScottS2017 commented Oct 11, 2018

I just had the same issue about unable to 'pub upgrade' flutter tool on October 11th. Deleting the cache folder did fix it.

I'm not using a power shell, this was from Windows command line.

Just thought you might like to know.

@zoechi

This comment has been minimized.

Copy link
Contributor

@zoechi zoechi commented Oct 11, 2018

Which directory did you install Flutter to?

@hzxiaojietan

This comment has been minimized.

Copy link

@hzxiaojietan hzxiaojietan commented Mar 21, 2019

Running pub upgrade...
Handshake error in client (OS Error:
CERTIFICATE_VERIFY_FAILED: unable to get local issuer certificate(handshake.cc:352))
Error (69): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (4 tries left)

@j1dopeman

This comment has been minimized.

Copy link

@j1dopeman j1dopeman commented May 8, 2019

I'm getting this error:

Downloading the Dart SDK using the BITS service failed, retrying with WebRequest...
Unzipping Dart SDK...
Exception calling "ExtractToFile" with "3" argument(s): "The process cannot access the file 'C:\src\flutter\bin\cache\dart-sdk\bin\dart.exe' because it is being used by another process."
At C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Archive\Microsoft.PowerShell.Archive.psm1:1059 char:25
+ ...             [System.IO.Compression.ZipFileExtensions]::ExtractToFile( ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : IOException

Building flutter tool...
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)
Running pub upgrade...
The system cannot find the path specified.
Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (8 tries left)
Running pub upgrade...
The system cannot find the path specified.

And it continues failing from there.

Edit: It worked after deleting cache and re-running from the cmd line.

@nsmith1024

This comment has been minimized.

Copy link

@nsmith1024 nsmith1024 commented May 29, 2019

I have this problem now, which cache did you delete to make it work?

I deleted the github cache in the flutter install folder but same result, keeps retrying over and over, now flutter seems all messed up because i cant do anything it just keeps retrying no matter what i do, even if im not trying to upgrade anymore it keeps trying all the time automatically.

@mit-mit

This comment has been minimized.

Copy link
Member

@mit-mit mit-mit commented May 29, 2019

I'd recommend renaming your current flutter folder to flutter_old, and then installing a new flutter folder from https://flutter.dev/docs/get-started/install/

@kishore-75

This comment has been minimized.

Copy link

@kishore-75 kishore-75 commented Jun 29, 2019

Looks like something went wrong while downloading the dart sdk. Can you delete the cache folder inside bin and then run flutter doctor again? What's the output?

Are you by any chance behind a firewall (or using a proxy) that might be blocking the download of the dart sdk
?
@goderbauer @09abhishek
Yes i am using a proxy how to solve this issue now?

@tarisham

This comment has been minimized.

Copy link

@tarisham tarisham commented Aug 11, 2019

hi
go to the bios and change vm (Virtual machine) from disable to enable. you want to run emulator so its Necessary.

@bdoubleu86

This comment has been minimized.

Copy link

@bdoubleu86 bdoubleu86 commented Aug 23, 2019

I'm getting this error:

Downloading the Dart SDK using the BITS service failed, retrying with WebRequest...
Unzipping Dart SDK...
Exception calling "ExtractToFile" with "3" argument(s): "The process cannot access the file 'C:\src\flutter\bin\cache\dart-sdk\bin\dart.exe' because it is being used by another process."
At C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\Microsoft.PowerShell.Archive\Microsoft.PowerShell.Archive.psm1:1059 char:25
+ ...             [System.IO.Compression.ZipFileExtensions]::ExtractToFile( ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : IOException

Building flutter tool...
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)
Running pub upgrade...
The system cannot find the path specified.
Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (8 tries left)
Running pub upgrade...
The system cannot find the path specified.

And it continues failing from there.

Edit: It worked after deleting cache and re-running from the cmd line.

I am having the same issue with extracting and before I had the issue "Unable to 'pub upgrade' flutter tool"

@MartinErskine

This comment has been minimized.

Copy link

@MartinErskine MartinErskine commented Aug 25, 2019

Can't get past this no matter what I do, nightmare!
Yes, I've tried changing the host folder, deleting the cache, running the pub upgrade directly et al, help!

Checking Dart SDK version...
Downloading Dart SDK from Flutter engine deca2c0...
Unzipping Dart SDK...
Building flutter tool...
Running pub upgrade...
[ +9 ms] executing: [C:\src\flutter] git -c log.showSignature=false log -n 1 --pretty=format:%H

@doha22

This comment has been minimized.

Copy link

@doha22 doha22 commented Aug 26, 2019

i fixed that problem by these steps :

  • first make sure you installed android studio then flutter not vice versa
  • second check your windows powershell is version 5 , if version 4 then upgrade it to version 5 (this step specially is fixing your specific problem)
  • from your flutter console : flutter upgrade and select flutter channel as here
    https://flutter.dev/docs/development/tools/sdk/upgrading
  • then in android studio install flutter plugin
@MartinErskine

This comment has been minimized.

Copy link

@MartinErskine MartinErskine commented Aug 27, 2019

I tried installing onto another PC:
Using Powershell, I noted that there were two instances of the cyan progress bar. The first for the BITS download of the Dart package and the other for the unzip process.
Running Flutter Doctor after initial install on the rogue PC only shows the first progress bar, not the second Unzip progress routine.
I tried again on the rogue PC and sure enough, no second step (unzip process). I appear to have unzipped files though.
I found mention elsewhere of 7zip failing quietly. I uninstalled 7Zip and went through the whole process again.
This time I got both progress bars, however, it still hangs on any flutter command.

@bdoubleu86

This comment has been minimized.

Copy link

@bdoubleu86 bdoubleu86 commented Sep 1, 2019

Running flutter doctor downloads the Dart SDK. However, extracting the archive does not work somehow. I am getting a lot of failures saying:

    + CategoryInfo          : ObjectNotFound: (C:\Users\Benjam...me\runtime.dart:String) [Remove-Item], ItemNotFoundEx
   ception
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand

I am using Windows Powershell 5.1

@cvuillecard

This comment has been minimized.

Copy link

@cvuillecard cvuillecard commented Sep 6, 2019

#12666

I just had the same issue after trying to install flutter on my windows platform
using the official web page for installing flutter (at this moment) :
https://flutter.dev/docs/get-started/install/windows

My configuration :

  • Windows 8 (64 bit)
  • PowerShell 4 upgraded to 5.1 after solved the problem
  • Git bash
  • Intellij

What i did :

  • i cloned the project's repository from 'stable' branch with git using the link suggested by the official installation page..
  • I followed the steps according the guide to execute 'flutter_console.bat' and tried to run the command 'flutter.bat doctor' in git bash
    (or 'flutter doctor' depending of which configuration or terminal you used)

Problem : it failed many times with the same error 'unable to pub upgrade' flutter tool (...)'

Finally, after few tries, i discovered that the executable 'pub.bat'
(which apparently is the package manager used with dart and flutter) wasn't in any flutter's sub-directories.
So i decided to install Dart from https://dart.dev/get-dart according the documentation, using the 'Dart SDK installer for Windows'.
Apparently, this installer doesn't create any entry in the windows global environment variables.

What i did to make the 'flutter.bat doctor' command work :

  • I installed Dart using the 'Dart SDK installer for Windows' from the official link.

  • I added an entry in the windows environment variables pointing to the dart sdk (for me 'C:\Program Files\Dart\dart-sdk') called : %DART_SDK%

  • I added a second entry in the windows environment variables pointing to the flutter installation's root folder (for me C:\framework\lib\flutter) called : %FLUTTER_ROOT%

  • In the flutter installation's directory, i modified the file 'flutter\bin\flutter.bat' to use the 2 environment variables.

  • In the begining of the file, just comment and modify the line assigning 'dart_sdk_path' as bellow :
    -> replace the line 'SET dart_sdk_path=%cache_dir%\dart-sdk' by 'SET dart_sdk_path=%DART_SDK%'
    -> The 'FLUTTER_ROOT' environment vriable just added is already used by the script.

  • Re-run 'flutter.bat doctor' or 'flutter_console.bat' and 'flutter doctor'.

It's the only solution i found at this moment with this version and the actual official guide,
but i hope the 'stable' repository of flutter is going to change to have a stable installation on windows with environment variables defined by default
to make sure the flutter.bat working on all windows platforms...

Note : I faced a second problem after installing the 'flutter' plugin using intellij version 2017
when i tried to configure the flutter SDK location in my settings (to just point the flutter directory cloned with git).
Finally the solution on this link helped me :
https://ladwhocodes.blogspot.com/2019/02/fix-flutter-sdk-not-found-in-specified-location.html
-> I hope it works for you in case of using intellij IDE.

@utkarshai

This comment has been minimized.

Copy link

@utkarshai utkarshai commented Sep 13, 2019

Failed to rename directory because access was denied.
This may be caused by a virus scanner or having a file
in the directory open in another application.

@utkarshai

This comment has been minimized.

Copy link

@utkarshai utkarshai commented Sep 13, 2019

this is what i got

@AoiKuiyuyou

This comment has been minimized.

Copy link

@AoiKuiyuyou AoiKuiyuyou commented Sep 14, 2019

I'm using Flutter 1.9.1 on Windows 10. In my case, a misconfigured 7-Zip
executable path has caused the extracting step to fail, leaving an empty dart-sdk directory.

The script that downloads the dart SDK archive file is _FLUTTER_DIR_\bin\internal\update_dart_sdk.ps1.

To find the URL of the archive file to download, add one line to update_dart_sdk.ps1:

Write-Host "The dart SDK archive file's URL is: $dartSdkUrl"

after the line:

$dartSdkUrl = "$dartSdkBaseUrl/flutter_infra/flutter/$engineVersion/$dartZipName"

Then run:

flutter doctor

to print the URL, and then terminate the process.

Now you can manually download the archive file and put it in the _FLUTTER_DIR_\bin\cache directory.

Then comment out the code in update_dart_sdk.ps1 that does the downloading:

# Try {
#     Import-Module BitsTransfer
#     Start-BitsTransfer -Source $dartSdkUrl -Destination $dartSdkZip
# }
# Catch {
#     Write-Host "Downloading the Dart SDK using the BITS service failed, retrying with WebRequest..."
#     # Invoke-WebRequest is very slow when the progress bar is visible - a 28
#     # second download can become a 33 minute download. Disable it with
#     # $ProgressPreference and then restore the original value afterwards.
#     # https://github.com/flutter/flutter/issues/37789
#     $OriginalProgressPreference = $ProgressPreference
#     $ProgressPreference = 'SilentlyContinue'
#     Invoke-WebRequest -Uri $dartSdkUrl -OutFile $dartSdkZip
#     $ProgressPreference = $OriginalProgressPreference
# }

Add 7-Zip's directory path to PATH:

SET PATH=%PATH%;_7ZIP_DIR_

Then run:

flutter doctor

It will skip the downloading step and start with the extracting step directly.

@KANCybernet

This comment has been minimized.

Copy link

@KANCybernet KANCybernet commented Jan 14, 2020

1. Ah, yeah; try a `git status` in the flutter directory to see what branch you are on.   You want to be either on "dev" or "master", dev is more stable; master is well the latest master.

2. You can try `..\..\bin\cache\dart-sdk\bin\pub.bat upgrade --verbosity=all --no-packages-dir` and see if it prints anything.   When I used "all" I got a LOT of output.

3. Have you tried deleting the "bin\cache" directory; and then doing a `flutter upgrade`

I Tried No.2 of your solutions, it printed out lots of stuffs buh still does not solve my problem...... my flutter has been working fine untill i tried upgrading, all of a sudden flutter stopped working.. Can anyone assist please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.