问题说明:
在使用PlatformIO编译ESP32-S3项目时遇到了Git克隆失败的错误,主要是网络连接问题。从错误信息看,主要是RPC失败和连接被重置,导致无法从GitHub下载arduino-esp32库。
保存信息:
Resolving esp32-s3-devkitc-1 dependencies... Removing unused dependencies... Library Manager: Removing ArduinoOTA @ 3.3.3+sha.0ae0838 Library Manager: ArduinoOTA@3.3.3+sha.0ae0838 has been removed! Library Manager: Installing git+https://github.com/espressif/arduino-esp32.git#2.0.9 git version 2.48.1.windows.1 Cloning into 'C:UsersAdministrator.platformio.cache mppkg-installing-5q465_tp'... error: RPC failed; curl 56 Recv failure: Connection was reset error: 370 bytes of body are still expected fetch-pack: unexpected disconnect while reading sideband packet fatal: early EOF fatal: fetch-pack: invalid index-pack output VCSBaseException: VCS: Could not process command ['git', 'clone', '--recursive', '--depth', '1', '--branch', '2.0.9', 'https://github.com/espressif/arduino-esp32.git', 'C:UsersAdministrator.platformio.cache mppkg-installing-5q465_tp']
【解决方案】使用镜像源,避免直接从GitHub克隆。
在platformio.ini中使用国内镜像:
lib_deps =
https://gitee.com/mirrors/arduino-esp32.git#2.0.9
例如:
直接修改你的 platformio.ini 文件,将 lib_deps 部分替换为国内Gitee镜像的地址:
[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
monitor_speed = 115200
; 其他配置...
lib_deps =
https://gitee.com/mirrors/arduino-esp32.git#2.0.9保存文件后,PlatformIO会自动从Gitee镜像下载,速度更快且更稳定。
