NodeMCU esp8266 can't upload

i am using a NodeMCU esp8266 to make a wifi clock. when I try to upload this code it says an error occurred while uploading the sketch.

Arduino: 1.8.5 (Windows 10), TD: 1.42, Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 4M (1M SPIFFS), v2 Prebuilt (MSS=536), Disabled, None, 9600"

Warning: Board breadboard:avr:atmega328bb doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA328BB
Build options changed, rebuilding all
Archiving built core (caching) in: C:\Users\jkdeu\AppData\Local\Temp\arduino_cache_200767\core\core_esp8266_esp8266_nodemcuv2_CpuFrequency_80,FlashSize_4M1M,LwIPVariant_v2mss536,Debug_Disabled,DebugLevel_None____,UploadSpeed_9600_6422f42a1d57872ad2f12a4708b48212.a
Sketch uses 323091 bytes (30%) of program storage space. Maximum is 1044464 bytes.
Global variables use 36116 bytes (44%) of dynamic memory, leaving 45804 bytes for local variables. Maximum is 81920 bytes.
C:\Users\jkdeu\AppData\Local\Arduino15\packages\esp8266\tools\esptool\0.4.12/esptool.exe -vv -cd nodemcu -cb 9600 -cp COM5 -ca 0x00000 -cf C:\Users\jkdeu\AppData\Local\Temp\arduino_build_46599/HTTPSRequest.ino.bin
esptool v0.4.12 - (c) 2014 Ch. Klippel ck@atelier-klippel.de
setting board to nodemcu
setting baudrate from 115200 to 9600
setting port from to COM5
setting address from 0x00000000 to 0x00000000
espcomm_upload_file
espcomm_upload_mem
setting serial port timeouts to 1000 ms
opening bootloader
resetting board
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
read 0, requested 1
trying to connect
flush start
setting serial port timeouts to 1 ms
setting serial port timeouts to 1000 ms
flush complete
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
espcomm_send_command: receiving 2 bytes of data
Uploading 327232 bytes from C:\Users\jkdeu\AppData\Local\Temp\arduino_build_46599/HTTPSRequest.ino.bin to flash at 0x00000000
erasing flash
size: 04fe40 address: 000000
first_sector_index: 0
total_sector_count: 80
head_sector_count: 16
adjusted_sector_count: 64
erase_size: 040000
espcomm_send_command: sending command header
espcomm_send_command: sending command payload
setting serial port timeouts to 15000 ms
setting serial port timeouts to 1000 ms
espcomm_send_command: receiving 2 bytes of data
writing flash
................................................................................ [ 25% ]
................................................................................ [ 50% ]
................................................................................ [ 75% ]
......................An error occurred while uploading the sketch

Try altering the Serial upload speed. I have some ESP boards that don't reset & upload reliably at high speeds and maybe low speeds can cause the same problems.

The image below are the settings I use. Try matching the same and try again.