Cannibalism in hermit crabs is not a normal or healthy behavior.
By nature hermit crabs are omnivorous and eat all sorts of dead and decaying things they find on the beach. Their job is that of beach cleaner and they play an important role in their environment. They are scavengers, not predators.
In captive hermit crabs we often hear stories of one crab attacking another crab and killing it. In most cases this simply isn’t true. If you didn’t witness the attack that killed one of the crabs you can’t assume it was murdered by another crab. In most of these situations the more likely scenario is that one crab died and the other crab does what comes natural, began eating the carcass.
Hermit crabs simply do not possess a malevolent tendency. Instead you have to look to their survival instinct in driving this type of behavior. After all any species will do everything it can to survive.
The only instance when a live hermit crab may be attacked by another hermit crab is during molt but this can be avoided.
First, your substrate needs to be deep enough to allow 6 inches of substrate ABOVE your largest crab if it were to dig down to the bottom of your tank. This will mask that molting scent that draws other crabs.
Second, you must feed your hermit crabs a well balanced diet to make sure their nutritional needs are being met so they don’t feel forced to eat a molter to fill a nutritional need, usually a protein deficiency.
Female hermit crabs are fertile after a molt. Do not confused mating and guarding behaviors as malicious intent or aggression. Read more on hermit crab mating.
Finally, don’t overcrowd your tank. Too many crabs in one tank is just asking for trouble.