This was already discussed in Update espressif 32 Version >4.1.0 leads to Error: collect2.exe: error: ld returned 1 exit status.
Use
[env:nodemcu-32s]
platform = espressif32
board = nodemcu-32s
framework = arduino
upload_port = COM6
monitor_speed = 115200
lib_deps =
me-no-dev/AsyncTCP@^1.1.1
https://github.com/khoih-prog/ESPAsyncWebServer/archive/refs/heads/master.zip
ayushsharma82/AsyncElegantOTA@^2.2.7
instead.