Preheat oven to 350°F. Line a muffin tin with cupcake liners and set aside.
In a large bowl, combine brown sugar, eggs, sour cream, vanilla, and oil. Mix on medium until smooth.
Add flour, baking powder, baking soda, salt, cinnamon, ginger, and nutmeg. Mix on low speed until fully incorporated, scraping the sides as needed.
Fold in the grated carrots until evenly distributed.
Scoop the batter into the cupcake liners, filling each about ⅔ full.
Bake for 20–22 minutes, or until the centers are set and a toothpick comes out clean. Let cool completely.
To make the frosting, beat together the butter, cream cheese, vanilla, and salt until smooth.
Slowly add powdered sugar while mixing on low. Increase to medium speed and beat until light and fluffy, about 2–3 minutes.
Transfer frosting to a piping bag fitted with a star tip. Pipe a swirl onto each cooled cupcake and top with chopped walnuts, if desired.