How flux compactification solves the moduli space problem in string theory? Please provide some details and, if posible, an example.
Nonzero fluxes are required because of some equations of motion linking them to a nonzero Euler character. Once they're there, they induce a superpotential that stabilizes some moduli, usually the complex structure moduli (the very "stabilizes" means that the allowed values of these moduli at which the total potential has a local minimum is discrete, assuming fixed values of other moduli).
The dilaton-axion field is stabilized by the Gukov-Vafa-Witten superpotential while nonperturbative effects are typically needed to stabilize the Kähler moduli.
This is of course a big technical topic and the literature on stabilized flux vacua is large. One can't describe everything in a single comment. The Becker-Becker-Schwarz textbook probably has a good treatment of these matters.