Frosting is a multiscale and multiphysics problem, which presents a significant challenge for numerical methods. In this study, a generalized lattice Boltzmann (LB) model is developed to simulate the frosting of humid air at representative elementary volume scale. In this model, three LB equations are introduced to describe the evolution of distribution functions for velocity, temperature, and humidity (i.e., mass fraction of water vapor in the humid air) fields, respectively. The frost layer is regarded as a porous medium, while the humid air is treated as a plain one. This unified LB model can be applied to describe the phase change and transport processes in these two subdomains seamlessly. Through the Chapman-Enskog analysis, the macroscopic equations for the frosting process can be recovered from the present LB model. Benchmark problems in conduction solidification, convection melting and frosting are simulated, and the numerical results match well with analytical or experimental solutions. Finally, this model is applied to simulate frost formation between two parallel plates, and the influences of air velocity, humidity, temperature, and cold wall temperature are evaluated.