I'm explaining this in a non-technical way...
First off: for arthropods (insects, crabs, etc.) - They have one or more very small brains, with large ganglia (globs of nerve cells, kinda like a computer router) sprinkled around their bodies in places like legs attachment sites, or in central locations away from the brain.
.
They do not exhibit neural plasticity (how we learn). Everything is hardwired in the brain(s) and in ganglia. So any responses are either the result of a pre-programmed scenario, or from hormone changes. So, "emotions" can be thought of as chemistry and or computer programs. Romantic, huh?
BTW - most human emotions are purely chemical responses - our brain and adrenal glands are both linked and controlled by hormones. You have probably heard of the fight-or-flight response in people faced with great danger. Your brain "shuts off" and you run like crazy, or if you cannot run then you try to fight. And then there are pheromones as well. These act like external "hormones" - as a complex species-specific chemical is dispersed into the air, all of the individuals from the same species who are nearby get the message. And sometimes excrete the same pheromone to get every individual possible "motivated". Example: Africanized bee colonies in the Southern US react very violently when one of their fellow bees gets smashed, like when a bear goes after the beehive. The bees swarm and sting and pursue any moving object.
So bugs would have emotions in the sense that an environmental cue elicits a hormonal repsonse. But I personally think that mapping human emotions onto animals with virtually no brain power is an anthropomorphic, not at all scientific approach. There are some studies in large mammal ethology that indicate responses that we would as humans map to a given set of emotions. Examples include elephants, wolves, great apes - generally highly social mammals. I am not in a position to validate the correctness of the "emotion" assertions I've seen in popularized versions of this kinds of research.