Preheat oven to 350°F (175°C). Grease a 9x13-inch baking pan.
In a large bowl, whisk oil, sugars, eggs, and vanilla until smooth.
Sift in flour, baking powder, baking soda, cinnamon, and salt. Mix until just combined.
Stir in grated carrots, pineapple, and walnuts (if using).
Pour batter into the pan. Bake for 30-35 mins or until a toothpick comes out clean.
Let cake cool completely before frosting.
Beat cream cheese and butter until smooth. Gradually add powdered sugar and vanilla.
Spread frosting over the cooled cake. Slice and enjoy!