Preheat oven to 350°F (175°C) and grease a 9x9 inch baking pan.
In a bowl, whisk together flour, baking powder, baking soda, cinnamon, nutmeg, and salt.
In another bowl, beat eggs, oil, granulated sugar, brown sugar, and vanilla until smooth.
Add dry ingredients to wet mixture and stir until just combined.
Fold in grated carrots and walnuts (if using).
Pour batter into prepared pan and spread evenly.
Bake for 30 minutes or until a toothpick inserted comes out clean.
Let cool completely before frosting.
For frosting, beat cream cheese and butter until fluffy.
Add vanilla and powdered sugar; mix until smooth and creamy.
Spread frosting over cooled bars, slice, and serve.