Preheat the oven to 350°F (175°C) and line a baking sheet with parchment paper.
In a medium bowl, whisk together the flour, baking powder, baking soda, cinnamon, nutmeg, and salt.
In a large bowl, cream together the brown sugar, granulated sugar, and butter until light and fluffy.
Add the eggs, one at a time, mixing well after each addition. Stir in the grated carrots.
Gradually add the dry ingredient mixture to the wet mixture, stirring until just combined.
Fold in the chopped nuts if using.
Drop tablespoon-sized balls of dough onto the prepared baking sheet, spacing them about 2 inches apart.
Bake for 12-15 minutes, or until the edges are golden and the centers seem set.
Allow the cookies to cool on the baking sheet for 5 minutes, then transfer to a wire rack.
While the cookies cool, prepare the cream cheese frosting by beating together the cream cheese, butter, powdered sugar, and vanilla extract until smooth and fluffy.
Once the cookies are completely cool, spread or pipe the cream cheese frosting onto each cookie.