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 to combine.
04 - Gradually add the dry ingredient mixture to the wet ingredients, folding gently until just combined. Avoid overmixing to keep the crumb tender.
05 - Gently fold in the freshly grated carrots along with the chopped nuts and drained crushed pineapple if using, distributing evenly throughout the batter.
06 - Divide the batter evenly between the prepared cake pans or pour entirely into the rectangular pan. Smooth the tops with a spatula for even baking.
07 - Bake for 35 to 40 minutes, or until a toothpick inserted into the center of each cake comes out clean. Transfer the pans to a wire rack and let the cakes cool completely in the pans before turning out.
08 - Using a hand or stand mixer, beat the softened cream cheese and unsalted butter together on medium speed until light and fluffy, about 2 minutes.
09 - Gradually add the sifted powdered sugar, vanilla extract, and a pinch of salt to the cream cheese mixture. Beat on medium-high speed until silky smooth and spreadable.
10 - If using round layers, place the first cake on a serving plate and spread frosting evenly over the top. Stack the second layer and frost the top and sides. For a single rectangular cake, spread the frosting evenly across the top surface.