We know the charge of an electron from Millikan's experiment, and the charge/mass ratio from Thompson's apparatus, hence the mass of an elecgtron.

Now we know there are 6.23 x 10^23 atoms per gram of hydrogen (Avogadro) and each consists of an electron and a proton, so we know the mass of a proton.

Helium atoms consist of two electrons, two protons, and two neutrons, and we know the density of helium relative to hydrogen, so we can calculate the mass of a neutron.