Yes you can repaint, but you must fix the mistakes from the past. All loose, peeling and failing paint must be removed. You need a good sound foundation to build from.
Try sanding, using a palm sander, with 100-120 grit sandpaper. This should "rip" the bad paint off the surface. For odd shaped areas you will have to do some hand sanding. A Medium/Course sanding sponge will do the trick. Once the "offending" paint is gone, you need to continue sanding with a finer grit. A final sanding with 150 grit paper and fine sanding sponges will produce a slick surface with very fine/small sanding scratches.
Now you can start the painting process. How you proceed depends on your skills and the final look you're after. You can spray the primer and paint, use a brush only or use a brush and fine short nap roller. Check out <a href="https://www.house-painting-info.com/article-simon_phillips-paint_bathroom_vanity.html">How To Paint A Bathroom Vanity Cabinet</a>, by Simon Phillips, for more details.
Personally, I like oil based products for cabinets. This includes the primer as well. A quick drying primer, like Kilz Original Oil Base, works very well for this purpose. Plan on two coats of primer with a light sanding between each coat. This will produce a super smooth surface ready for paint.
You don't have to use an oil based paint. A good semi-gloss acrylic will do a good job and easily stick to the oil based primer.
No matter what application method you use or type of primer and paint, always condition the primer and paint. This is more than thinning. Specialized paint conditioners to consider are Floetrol, for water based primers and paints, and Penetrol, for oil based primers and paints. These conditioners will help the paint lay down on the cabinet surfaces, minimizing brush marks and roller stipple. Well worth the small investment.