Error triggering push button / pin state

I have a push button connected to a digital pin on a nodeMCU board (with a pull up resistor), when I connect a fan the nodeMCU board behaves as if the push button had been pressed.
Do you have any idea what might be happening?
