Preheat to 350°F (175°C). Grease and line two 9-inch pans or one 9×13-inch dish.
In a bowl, whisk flour, baking powder, baking soda, cinnamon, nutmeg, and salt.
In another bowl, whisk sugars and oil until smooth. Add eggs one at a time.
Gradually combine dry ingredients with wet until just mixed.
Add carrots, pineapple, and optional coconut.
Pour into pans and bake for 30–35 minutes or until a toothpick comes out clean.
Let cool 10–15 minutes; transfer to rack.
Beat cream cheese and butter until fluffy. Add sugar, vanilla, and milk or pineapple juice.
Spread frosting evenly and garnish with coconut or nuts.
