Heat the oven to 350°F and line a muffin pan with paper liners. The pan should be ready before you mix anything.
In a bowl, whisk the flour, baking powder, baking soda, and salt. The mix should look even, with no lumps.
In another bowl, whisk the sugar, eggs, and oil until smooth and slightly thick.
Stir the dry mix into the wet mix using a spatula. Stop once the batter comes together. It should look thick, not runny.
Fold in the grated carrots and chopped nuts. The batter should show carrot pieces all through it.
Spoon the batter into the liners, filling each about three-quarters full.
Bake for about 20–22 minutes, until the tops look set and a toothpick comes out clean.
Let the cupcakes cool fully before frosting. They should feel cool to the touch.
Beat the cream cheese and butter until smooth, then mix in the powdered sugar until thick and creamy.
Spread or pipe the frosting on the cooled cupcakes. Add nuts or carrot pieces on top if you like.