For some reason some of my D1 Mini clones from aliexpress won't take code without this method from https://www.reddit.com/r/esp8266/comments/7398fn/resetting_wemos_d1_mini/
Connect:
D3 (GPIO 0) -> GND
D8 (GPIO 15) -> GND
D4 (GPIO 2) -> 3v3
An erase_flash may be needed before uploading new firmware
Without this I get this result in esptool (including in arduino IDE): A fatal error occurred: Failed to connect to ESP8266: Timed out waiting for packet header
I ran into a further issue where the D1 minis would boot and output something like
ets Jan 8 2013,rst cause:2, boot mode:(4,0)
waiting for host
At 74880 baud, rather than running my sketch. Supposedly for boot the same pins must be set to mode 3 as per this thread: https://www.esp8266.com/viewtopic.php?f=6&t=1094
D3 (GPIO 0) -> 3v3
D8 (GPIO 15) -> GND
D4 (GPIO 2) -> 3v3
One board I had in the triple-socket adapter board didn't flash or run without the pins specifically connected for some reason. Outside of the adapter board (which had nothing else plugged in) it didn't need this.
Upon measurement, the triple adapter base had (by itself)
D3: No connection to GND, 3v3, or 5v
D8: No connection to GND, 3v3, or 5v
D4: ~200 ohms to ground, ~50 kOhms to 3v3, ~3 MOhms to 5V
The adapter base was quite clean and I couldn't find any links from D4 to other pins, not even flux residue. However, GND to 3v3 also had about ~50 kOhms (!!), so it seems like there must be something like a flux bridge underneath one of the soldered headers that connected D4, GND, and 3v3 together (their tracks are next to each other).
So, the ESP8266 can be quite sensitive to erroneous voltages from connected parts or soldering flaws and this can prevent it from booting or flashing.