Preheat your oven to 350°F (175°C). Line a muffin tin with paper cupcake liners.
In a large bowl, combine flour, granulated sugar, brown sugar, baking soda, baking powder, salt, cinnamon, and nutmeg. Mix well.
In another bowl, whisk together the vegetable oil and eggs until combined. Add the grated carrots and crushed pineapple, mixing until well combined.
Gradually add the wet ingredients to the dry ingredients, stirring gently until just combined. Fold in the chopped walnuts or pecans if desired.
Divide the batter evenly among the cupcake liners, filling each about two-thirds full.
Bake in the preheated oven for 18-20 minutes, or until a toothpick inserted into the center comes out clean. Allow to cool in the pan for 5 minutes, then transfer to a wire rack to cool completely.
While the cupcakes are cooling, prepare the cream cheese frosting. In a bowl, beat the softened cream cheese and butter until creamy and well combined.
Gradually add the powdered sugar, mixing until smooth. Stir in the vanilla extract and salt.
Once the cupcakes are completely cool, frost them with the cream cheese frosting using a spatula or a piping bag.