Either your cartridge has dirty contacts, the connector in the machine has dirty/tarnished/corroded/loose contacts, or both.

Trust me, I've repaired many, many hundreds of NESs.