Preheat the oven to 350°F. Line 12 muffin cups with paper liners and spray them with nonstick spray.
In a medium bowl, stir together the flour, baking powder, baking soda, cinnamon, and salt in a medium bowl. Add the carrots and raisins and/or nuts if using and stir to combine well. In another large bowl stir together the sugar, butter, eggs, and pineapple until well blended. Add the flour in three batches, stirring after each addition just until combined.
Scoop the batter into the muffin liners, filling each a generous three-quarters full. Bake until a toothpick or a wooden skewer inserted into the middle of a cupcake comes out clean, about 25 minutes. Cool in the muffin pans on a wire rack for 10 minutes, then remove the muffins from the pans and finish cooling on the wire racks.
While the cupcakes bake, make the frosting: Place a small saucepan inside a larger saucepan and add water to the larger pan so that it comes up about ½ inch around the sides of the smaller pan. Add the chocolate chips to the small pan and heat over medium-high heat, whisking occasionally, until the water is gently simmering, and the chips are melted. Stir the sour cream and cream cheese into the chocolate and continue whisking until the mixture is completely smooth and blended. Whisk in the vanilla. Allow to cool to room temperature (the frosting will thicken as it cools).
When the cupcakes have completely cooled, frost with the cooled frosting.
Notes
Mixing the shredded carrots, raisins and nuts with the dry ingredients coats them and then allows them to blend into the wet ingredients evenly. It also prevents them from sinking to the bottom of the cupcakes as they start to bake.Make sure to spray the cupcake liners with nonstick cooking spray so the wrappers come off of the cupcakes easily. If you want to make your cupcakes look super Easter-ey, pick up some cute Easter themed cupcake liners. Try whipped chocolate ganache for another topping option!