Gamma-ray emission at energies >100MeV has been detected from nine novae using the Fermi-LAT, and it can be explained by particle acceleration at shocks in these systems. Eight out of these nine objects are classical novae in which interaction of the ejecta with a tenuous circumbinary material is not expected to generate detectable gamma-ray emission. We examine whether particle acceleration at internal shocks can account for the gamma-ray emission from these novae. The shocks result from the interaction of a fast wind radiatively-driven by nuclear burning on the white dwarf with material ejected in the initial runaway stage of the nova outburst. We present a one-dimensional model for the dynamics of a forward and reverse shock system in a nova ejecta, and for the associated time-dependent particle acceleration and high-energy gamma-ray emission. Non-thermal proton and electron spectra are calculated by solving a time-dependent transport equation for particle injection, acceleration, losses, and escape from the shock region. The predicted emission is compared to LAT observations of V407 Cyg, V1324 Sco, V959 Mon, V339 Del, V1369 Cen, and V5668 Sgr. The 100MeV gamma-ray emission arises predominantly from particles accelerated up to ~100GeV at the reverse shock and undergoing hadronic interactions in the dense cooling layer downstream of the shock. The internal shock model can account for the gamma-ray emission of the novae detected by Fermi-LAT, including the main features in the observations of the recent gamma-ray nova ASASSN-16ma. Gamma-ray observations hold potential for probing the mechanism of mass ejection in novae, but should be combined to diagnostics of the thermal emission at lower energies to be more constraining. (abridged version)