Preheat the oven to 350°F (175°C).
Grease and flour two 9-inch round cake pans.
In a bowl, whisk flour, sugar, baking powder, baking soda, salt, and cinnamon.
In another bowl, beat eggs until light and fluffy.
Gradually add oil, continuing to beat.
Stir in grated carrots, crushed pineapple, and chopped nuts.
Gently fold wet ingredients into dry ingredients.
Divide batter evenly between prepared pans.
Bake for 25-30 minutes, until a toothpick comes out clean.
Let cakes cool in pans for 10 minutes.
Remove cakes from pans and transfer them to a wire rack.
In a bowl, beat cream cheese and butter until smooth.
Gradually add powdered sugar, one cup at a time.
Beat until the frosting is smooth and creamy.
Stir in vanilla extract.
Spread frosting on top of one cake layer.
Place the second cake layer on top.
Frost top and sides with remaining cream cheese frosting.
Optionally, garnish with chopped nuts or grated carrots.
Slice and serve your delicious carrot cake!