A scheme for the preparation of a Fock state is proposed. We study two lights interacting in a Kerr media with self-phase modulation. The signal light and the probe light whose initial states are both coherent states will be entangled via interaction, then when a quadrature component of the probe light is measured, the photon number distribution of the signal light is modulated. Repeating the process, we find the signal will collapse into a Fock state finally, and the physical principle of this evolution is based on the cross-phase modulation, the self-phase modulation may hinder the preparation of a Fock state.