My son bit my nephew

My 2 and a half year old son has begun acting up the past few months. We go to my moms twice a week and my 2 other sisters and their kids come too (all around the same age as my son). My son gets super excited to see them, however lately he’s been quite naughty, perhaps out of excitement, I’m not sure. He pushes his cousins and keeps getting in their space. I’m constantly pulling him away but he keeps going back. Today for the first time ever, he bit my nephew. It was a deep bite and my nephew cried hard. My sister was so angry at my son and so was everyone else, yelling at him at the same time. Honestly I was just in shock and speechless, I was hurt that everyone was yelling at him but also mad that he bit my nephew. I yelled at him and told him it was wrong, he hurt his cousin, threatened we wouldn’t come over anymore. I don’t think I handled it correctly, how should I have handled the situation? I know my sister was so mad at my son and told me he needs to be hit.