Recently I came across a faulty NodeMCU D1 Mini. The LED on the ESP8266 stays on and my computer is going crazy.

The solution I found is to force it into programming mode by soldering a wire between GPIO0 and ground (D3 and G). Click here for the pinout.

You can now upload the new firmware and then desolder the wires. Your NodeMCU/WeMos D1 Mini will work fine from now on.