Code uploads successfully on esp8266-01 but doesn't run I am using esp8266-01 board. It was working fine few days ago, the codes uploaded and ran successfully. But now that I upload code to it, it gets uploaded successfully but it doesn't work.

I am using arduino nano to program it. It is connected as:
esp-01       arduino nano
tx-------------tx
rx-------------rx
vcc------------3v3
ch_pd----------3v3
gpio0----------gnd
gnd------------gnd

the code is basic blink code:

void setup(){
   pinMode(2, OUTPUT);
   }
void loop(){
   digitalWrite(2, HIGH);
   delay(500);
   digitalWrite(2, LOW);
   delay(500);
   }


This code gets uploaded successfully (According to IDE atleast) but it doesn't run. LED connected to gpio2 is always on. I also tried gpio0 and gpio1 but no luck.

I have already spend days trying to fix this. Please Help.
if you are using a nodemcu, the pin numbers do not correspond to the digital pins, they correspond to the gpio pins. The digital pin 2 is the gpio 4 and the digital pin 4 is the gpio 2.
Here you have a list of digital and gpio pins:

D0 = GPIO16;
D1 = GPIO5;
D2 = GPIO4;
D3 = GPIO0;
D4 = GPIO2;
D5 = GPIO14;
D6 = GPIO12;
D7 = GPIO13;
D8 = GPIO15;
D9 = GPIO3;
D10 = GPIO1;