Preheat your oven to 350°F. Grease and flour a 9x13-inch baking dish.
In a large bowl, whisk together the flour, sugar, baking powder, baking soda, salt, cinnamon, and nutmeg.
In a separate bowl, beat the eggs, then add the vegetable oil and vanilla extract. Mix well until combined.
Pour the wet ingredients into the dry ingredients and stir until just combined. Gently fold in the grated carrots, crushed pineapple, and nuts (if using).
Pour the batter into the prepared baking dish and smooth the top with a spatula.
Bake for 35-40 minutes or until a toothpick inserted into the center comes out clean. Allow the cake to cool completely in the pan.
While the cake is cooling, prepare the cream cheese frosting. In a mixing bowl, beat together the softened cream cheese, butter, powdered sugar, and vanilla extract until smooth and creamy.
Once the cake has cooled, spread the cream cheese frosting evenly over the top.
Slice the cake into squares and serve. Enjoy!