Preheat the oven to 350℉ and line a cupcake pan with 12 paper liners.
Make Carrot Cupcakes
To a medium mixing bowl, add flour, baking powder, baking soda, salt, cinnamon and ginger. Whisk well to combine. Set aside.
To a large mixing bowl, add vegetable oil, brown sugar, and white sugar. Whisk well to combine. Add the eggs one by one, whisking to combine after each addition. Then add the vanilla extract and mix again.
Sift the flour mixture into the bowl of cupcake batter. Use a wooden spoon or mixing spatula to gently fold the ingredients together. Avoid over mixing, which can cause cupcakes to be dry/crumbly.
Add the shredded carrots to the batter and gently fold again to combine.
Transfer the mixture to prepared cupcake pan. Each liner should be about two-thirds full with batter.
Bake in preheated oven for 18-22 minutes, or until a toothpick inserted into the center of a cupcake comes out clean or with a few loose crumbs.
Remove from oven and leave the cupcakes in the pan for about 10 minutes before transferring them to a wire rack to cool completely.
When the cupcakes are cool, make the frosting.
Make Cream Cheese Frosting
Add the butter to the bowl of a stand mixer (or use an electric hand mixer) and beat on high speed until completely smooth.
Sift in the powdered sugar and beat on medium speed until very smooth and fluffy, about 5 minutes. *To prevent a powdered sugar storm, start the mixer on low speed.
Add the cream cheese and vanilla extract and beat on medium speed for another few minutes, until thick and fluffy.
Assemble the Cupcakes
Add frosting to a piping bag inserted with a star tip (or use a knife to spread the frosting). *I use a Wilton 1M piping tip. Pipe swirls of the cream cheese frosting on top of each cupcake. If desired, sprinkle tops of cupcakes with finely chopped walnuts.
Notes
For a moist and tender cake, bring all ingredients, including refrigerated ingredients, to room temperature before you start baking.
To prevent cupcakes from sticking to the pan, line the wells with paper cupcake liners. In my experience, plain white liners are best. Decorative liners tend to bleed colors onto the pan. If you want to use decorative cupcake liners, simply slip them over the white ones just before you frost the cupcakes.