Preheat the oven to 350°F (175°C). Grease and line two 9-inch round cake pans with parchment paper.
In a large bowl, whisk together the flour, brown sugar, baking soda, baking powder, cinnamon, nutmeg, and salt.
In a separate bowl, beat the eggs and oil until combined. Stir in the grated carrots and crushed pineapple.
Pour the wet mixture into the dry ingredients and fold gently until just combined, being careful not to overmix.
If using nuts, fold them into the batter now.
Divide the batter evenly between the prepared pans. Bake for 25-30 minutes, or until a toothpick inserted in the center comes out clean.
Allow the cakes to cool in the pans for 10 minutes before transferring to a cooling rack.
Beat the cream cheese and butter together until smooth. Gradually add the powdered sugar and vanilla extract, beating until creamy.
Place one cake layer on a plate, spread with frosting, then top with the second layer. Frost the top and sides.