Be sure that the shifter is in its lowest position (work the small shift lever several times), with all of the slack out of the cable before attaching the cable to the derailleur.
Run the barrel adjuster most of the way in (clockwise) before attaching the cable.
Be sure the cable is properly attached to the derailleur.
Al