This is good advice. OP, use studs, not anchors. I’ve never had good luck using wall anchors on drywall.
if the spacing doesn’t work for your, another option would be to use angle brackets hooked to the shelf and into a stud (optimally two studs).
If the unit cannot span two studs, center the unit on one stud and put an angle bracket on each shelf into the stud, then anchor the corners using drywall anchors - the brackets should take care of most of the weight and I would think the drywall anchors would hold and provide stability.
If the unit can span two studs, center the unit over those studs and do the same, attaching angle brackets under each shelf. At that point you can skip the drywall anchor rigamarole.
Of course, the angle brackets would end up being visible, so you may want to paint them or camouflage them in some other way.