Preheat the oven to 350°F (175°C). Grease and flour a 9-inch round cake pan.
In a bowl, whisk together flour, baking powder, baking soda, cinnamon, nutmeg, and salt.
Beat the butter and brown sugar until creamy.
Add the eggs one at a time, mixing well after each addition.
Stir in the vanilla and grated carrots.
Gradually add the dry ingredients to the wet mixture, folding in the walnuts or pecans.
Pour the batter into the prepared pan and bake for 40 minutes, or until a toothpick comes out clean.
Let the cake cool on a rack.
For frosting, beat the cream cheese and butter until smooth. Gradually add powdered sugar and vanilla, mixing until creamy.
Frost the cooled cake generously and serve.