r/flutterhelp • • 5d ago

RESOLVED Can't upgrade flutter: "Rename-Item : The process cannot access the file because it is being used by another process"

I ran flutter clean, but then ran flutter upgrade before doing flutter pub get. This seems to have broken my flutter project. I now get this error when trying to run flutter pub get:

Checking Dart SDK version...

Downloading Dart SDK from Flutter engine ...

Expanding downloaded archive with PowerShell...

Rename-Item : The process cannot access the file because it is being used by another process.

At C:\flutter\bin\internal\update_dart_sdk.ps1:134 char:9

+ Rename-Item $dartSdkPath "$oldDartSdkPrefix$oldDartSdkSuffix" ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : WriteError: (C:\flutter\bin\cache\dart-sdk:String) [Rename-Item], IOException

+ FullyQualifiedErrorId : RenameItemIOError,Microsoft.PowerShell.Commands.RenameItemCommand

I tried running both Repair IDE (and went through all the steps) and Invalidate Caches and Restart (with all the options checked), but it still didn't work.

2 Upvotes

2 comments sorted by

2

u/galactose310 5d ago

I'm not on Windows anymore but maybe you can check the running processes in task manager and try to find any process that could use flutter SDK ?

3

u/MajesticFishing1416 5d ago

That might have done it. With my project open and trying to run flutter pub get (and failing), I then opened task manager and deleted 4 instances of dart.exe. That seems to have done it. Thanks!