Preheat your oven to 350°F (175°C).
Grease and line two 9-inch round cake pans with parchment paper to prevent sticking.
In a mixing bowl, whisk together the flour, sugar, baking powder, baking soda, salt, and all the aromatic spices – cinnamon, nutmeg, cloves, and allspice.
In another mixing bowl, combine the vegetable oil and eggs. Mix until well combined.
Gradually add the grated carrots and crushed pineapple, stirring until they are evenly distributed.
Gently fold the dry mixture into the wet mixture, being careful not to overmix.
If desired, fold in the chopped walnuts for added texture.
Divide the cake batter evenly between the prepared cake pans.
Bake in the preheated oven for 25-30 minutes or until a toothpick inserted into the center comes out clean.
Allow the cakes to cool in their pans for 10 minutes before transferring them to a cooling rack.
While the cakes cool, prepare the cream cheese frosting by beating the softened cream cheese, butter, powdered sugar, and vanilla extract until smooth and creamy.
Once the cakes are completely cool, spread a layer of cream cheese frosting over one cake layer.
Place the second cake layer on top and frost the entire cake with the remaining cream cheese frosting.
If desired, decorate your carrot cake with additional chopped walnuts and shredded coconut.
Slice and savor your homemade Chef John's Carrot Cake with a hot cup of coffee or tea. It's perfect for any occasion.