Preheat oven to 350 degrees Fahrenheit and prepare a 9 x 13 inch pan.
In a bowl, mix flour, baking soda, baking powder, salt, cinnamon, and nutmeg until well combined.
In a separate bowl, mix sugars and oil until blended. Add eggs one at a time, mixing well after each addition. Stir in vanilla extract.
Gradually add dry ingredients into the wet mixture and stir until just combined. Do not overmix.
Fold in grated carrots and crushed pineapple. Add coconut and nuts if using. Mix gently until evenly distributed.
Pour batter into the prepared pan and spread evenly.
Bake for 35 to 45 minutes or until a toothpick inserted in the center comes out clean.
Remove from oven and allow the cake to cool completely in the pan.
Prepare frosting by beating cream cheese and butter until smooth. Add powdered sugar gradually and mix until creamy. Stir in vanilla.
Spread frosting over the cooled cake, slice, and serve.