PlatformIO ESP-IDF build error: permission denied

PlatformIO ESP-IDF build error: Permission denied on deleting component

Hey everyone,

I’m getting a build error in PlatformIO using ESP-IDF with my ESP32-S3 project.

Everything starts fine, but then I see a bunch of “skipping optional dependency” messages for things like esp_hosted and esp_wifi_remote. After that, it tries to delete an unused component (littlefs), but then the build fails with this:


PermissionError: [WinError 5] Access is denied:

'C:\\PowerSpoofer\\PowerSpoofer\\firmware\\managed_components\\littlefs\\.git\\objects\\pack\\pack-xxx.idx'

It seems to crash during the dependency cleanup phase. Here’s part of the traceback:


File "idf_component_manager\\prepare_components\\prepare.py", line 130, in main

args.func(args)

File "idf_component_manager\\prepare_components\\prepare.py", line 29, in prepare_dep_dirs

).prepare_dep_dirs(

File "idf_component_manager\\core.py", line 757, in prepare_dep_dirs

downloaded_components = download_project_dependencies(

File "idf_component_manager\\dependencies.py", line 84, in detect_unused_components

shutil.rmtree(os.path.join(managed_components_path, unused_component_name))

...

File "shutil.py", line 620, in _rmtree_unsafe

os.unlink(fullname)

PermissionError: [WinError 5] Access is denied

Any idea why it can’t delete that folder or how to fix it? I already tried restarting PlatformIO and checked that nothing else is using the file.

Thanks in advance!

Without platformio.ini it is guessing

There is a .ini file. Basically this is an old project and platformio automatically updated everything and I now get these errors