i have problem at generic esp8266

i control my tv with generic esp8266 and the code work correctly but when i start power generic esp8266 it dont connect to wifi when IR led connected to any gpio pin it dont connect to wifi so i disconnect IR led then it connect to wifi then i reconnect IR led i need any help at that problem

Please post your circuit diagram. Some of the ESP8266 pins are used to control how the chip boots up, and your LED might also be drawing too much current.

the IR led work correctly but at fisrt i should disconnect the led until board connected to wifi then i connect led again

that the connection the board dont connect th wifi untill i disconnect the green wire at gpio 2 and when it connect to wifi i reconnect green wire then it work correctly

mostafatalat19's Untitled.png:

GPIO2 is one of the pins that the ESP8266 uses to set the boot mode when it starts up. I imagine that having something connected to that is changing the boot mode so the ESP8266 isn't booting like normal.
Also, you need to have a current limiting resistor for the LED, and a resistor for the transistor- is it a MOSFET or BJT?
Also you might need to supply the LED from 5V not 3.3V, the 3.3V regulator on the Arduino can't supply much current.

i try the all pin and the same problem gpio 0 /1/2/3

That Fritzing wiring photo is pretty useless, can you give us a proper schematic? A good picture of a hand drawn picture is fine.

GPIO0 is involved in the boot process and must be pulled high for normal boot, low for program mode.
GPIO2 is also part of the boot process and must be left floating or be pulled high for normal boot. It will not boot when pulled low. If left floating it's pulled high by the internal pull-up, which is enabled on boot.

You can use an LED on GPIO0 or GPIO2 if you wire it between pin and Vcc, making it active LOW. Of course you must add a current limiting resistor as well.

GPIO1 and 3 are the Tx/Rx pins. If you use Serial communication you can't use those for other I/O.

where can i add the resistor plz i search and know the cause of my problem is transistor it draw current and make gpio low and the board cant boot so how can i solve that problem

Series resistor with the LED; base resistor on your transistor.

That still doesn't solve the problem by itself, you also have to switch to high side switching with a PNP transistor.
schematic.png
The 47Ω of R2 is based on 1.5V VF for the IR LED + 0.3V VCE for the PNP = 1.8V total drop, 3.3V supply, giving you 32 mA for the LED.
The 1k of R1 is based on <20x amplification to ensure the transistor is in saturation; at this value it's about 9x amplification. Any value up to 2k2 will do fine here, don't go higher than that or lower than 1k.
As your pin is pulled high at boot, the LED is kept off. Also the PNP can not pull the pin low. Set the pin to LOW to switch on the LED (reverse the logic in your code).

schematic.png