Preheat oven to 350°F (175°C). Grease and flour a 9×13 inch baking pan.
Mix Dry Ingredients:
In a bowl, whisk together flour, baking powder, baking soda, cinnamon, and salt.
Mix Wet Ingredients:
In a large bowl, beat sugar, eggs, oil, and vanilla until smooth.
Combine:
Gradually add the dry ingredients to the wet ingredients, mixing until just combined. Fold in grated carrots, drained pineapple, and walnuts if using.
Bake:
Pour the batter into the prepared pan and bake for 35–40 minutes, or until a toothpick inserted in the center comes out clean. Let the cake cool completely.
Make the Frosting:
Beat cream cheese and butter until creamy. Add powdered sugar and vanilla, beating until smooth.
Assemble:
Spread frosting over the cooled cake. Garnish with pineapple chunks and shredded carrots.
