01 - Preheat oven to 350°F. Grease and flour two 8-inch round cake pans or one 9x13-inch rectangular pan, then line the bottoms with parchment paper.
02 - In a medium bowl, whisk together the all-purpose flour, baking powder, baking soda, ground cinnamon, ground nutmeg, and salt until evenly distributed.
03 - In a large bowl, beat the room-temperature eggs with granulated sugar and packed light brown sugar until smooth and slightly pale. Stream in the vegetable oil and vanilla extract, mixing thoroughly.
04 - Gradually fold the dry ingredient mixture into the wet ingredients, stirring gently until just combined. Do not overmix.
05 - Gently fold in the grated carrots along with the chopped nuts and drained pineapple if using, distributing evenly throughout the batter.
06 - Divide the batter evenly between the prepared pans and smooth the tops. Bake for 35 to 40 minutes, or until a toothpick inserted into the center comes out clean.
07 - Let the cake layers cool completely in their pans set on a wire rack before attempting to frost.
08 - In a mixing bowl, beat the softened cream cheese and unsalted butter together until light and fluffy. Gradually add the sifted powdered sugar, vanilla extract, and a pinch of salt, beating until smooth and creamy.
09 - Spread frosting evenly over the cooled cake. For a layered cake, place the first layer on a serving plate, spread frosting across the top, stack the second layer, and frost the top and sides uniformly.