Compaction–dissolution waves in porosity and melt pressure form spontaneously in numerical simulations of melt migration in an upwelling, viscously compacting, porous column in a solubility gradient. The melt fraction is assumed to be small and the solid comprises olivine and orthopyroxene. The solubility of orthopyroxene in the melt is assumed to increase linearly with height and induces a gradient reaction, assumed to be at local equilibrium. Approximations for the vertical, 1-D, steady-state solutions are derived assuming negligible resistance to compaction. The linear stability of the steady-state solutions is characterized by complex eigenvalues and an oscillatory instability with strong wavenumber selection. This instability leads to the formation of checkerboard compaction–dissolution waves observed in the non-linear numerical simulations. The phase velocity of these waves is larger than the solid velocity but smaller than the melt velocity. The oscillatory instability is realized over a range of parameters and the variation in wave properties is explored. A power-law bulk-viscosity formulation, ξ=η/ϕmf, is shown to decrease growth rates linearly in the exponent, m. For small perturbations, the growth rates and phase velocities measured from high-resolution numerical simulations are predicted by the linear theory as well as the dominant wavenumber in the non-linear regime. We present a regime diagram for reaction infiltration instabilities in viscously compacting porous media and show that compaction–dissolution waves are favoured by increasing solid upwelling and small solubility gradients relative to high-porosity channels. The regime diagram suggests that the formation of compaction–dissolution waves is a feasible new physical mechanism for melt transport beneath mid-ocean ridges.