nodemcu esp8266 does not boot up when 5V pin is connected as a VIN source
IO pins 0, 2 and 15 are boot configuration pins. 15 must be LOW at boot, 2 must not be LOW at boot and 0 determines the flashing mode. For normal run pin 0 must be HIGH. The NodeMcu board has necessary pull-up and pull-down circuits.

You can connect to pins 0, 2 and 15 only devices which don't change the boot state.