Failed to rename directory because access was denied in flutter

Viewed 10629

Hi im trying to upgrade the version on my current flutter however i encounter this error Failed to rename directory because access was denied as i need to do changes to my system any suggestion will be appreciated.

Hi im trying to upgrade the version on my current flutter however i encounter this error Failed to rename directory because access was denied as i need to do changes to my system Please take a look of my screen capture any suggestion will be appreciated

8 Answers

Try running the command flutter pub get -v.

It shows the log and can even solve the problem.

I had the same issue. None of the answers worked. I deleted .dart_tool folder in the project folder and it worked :)

Try to disable your antivirus for like 5 minutes and then go to the flutter directory

C:\src\flutter

and run the command

flutter pub global activate devtools

Note: The flutter path should be set in env variables before running this.

Run the following command:

flutter pub global activate devtools

Then try to get the packages again.

I hope this helps fix the issue

When all other command don't working (in my case is my antivirus block flutter command), I launch in my project folder:

/flutter/bin/cache/dart-sdk/bin/dart __deprecated_pub --verbose get --no-precompile

the command stop on rename folder error.

I rename with cp command the folder and after the command flutter pub get working fine.

run flutter pub get -v this will show you what folder it is trying to rename to what. Manually rename the folder and place it in the path it was trying to place. re-run flutter pub get -v, repeat until it says exit with 0.

This is how I proceeded to resolve that problem:

First I had to run the command bellow to see in details what he is trying to rename:

flutter pub get -v

After that in the console I searched for the term "renaming" and I found this: enter image description here

So I had to go to the path specified in the console where flutter was installed, and I found this: enter image description here

Then I deleted all the folders, and tried to run the command flutter pub get again. it didn't work, so I restored the deleted folders, and I tried again for the second time. And magically the command worked successfully.

Do "pub cache repair" and try "pub get"

Related