Driving IR led from 3.3V GPIO using 2N2222 transistor
What am I doing wrong?


In plain language, you mixed up the positions of the transistor and the LED.

To use an NPN transistor for this, you should wire it as a Low Side Switch.  That means that the Emitter should go to ground, and the Collector should go to the cathode of the LED.  The LED anode then connects to the current limit resistor.

Stack the LED "on top of" the transistor, not the transistor on top of the LED as you've done.

Also be careful to drive this from a NodeMCU pin that doesn't need to be high to boot into your desired mode, as the resistor and transistor base may operate like a pull-down resistor.