Context. Theories of the origins of life propose that early cell membranes were synthesised from amphiphilic molecules simpler than phospholipids, such as fatty alcohols. The discovery in the interstellar medium (ISM) of ethanolamine, the simplest phospholipid head group, raises the question whether simple amphiphilic molecules are also synthesised in space. Aims. We investigate whether precursors of fatty alcohols are present in the ISM. Methods. To do this, we have carried out a spectral survey at 7, 3, 2 and 1 mm towards the Giant Molecular Cloud G+0.693-0.027 located in the Galactic centre using the IRAM 30 m and Yebes 40 m telescopes. Results. Here, we report the detection in the ISM of the primary alcohol n-propanol (in both conformers Ga-n-C3H7OH and Aa-n-C3H7OH), a precursor of fatty alcohols. The derived column densities of n-propanol are (5.5 ± 0.4) × 1013 cm−2 for the Ga conformer and (3.4 ± 0.3) × 1013 cm−2 for the Aa conformer, which imply molecular abundances of (4.1 ± 0.3) × 10−10 for Ga-n-C3H7OH and of (2.5 ± 0.2) × 10−10 for Aa-n-C3H7OH. We also searched for the AGa conformer of n-butanol [AGa-n-C4H9OH] without success, yielding an upper limit to its abundance of ≤4.1 × 10−11. The inferred CH3OH:C2H5OH:C3H7OH:C4H9OH abundance ratios are 1:0.04:0.006:≤0.0004 towards G+0.693-0.027, that is, they decrease roughly by one order of magnitude for increasing complexity. We also report the detection of both syn and anti conformers of vinyl alcohol, with column densities of (1.11 ± 0.08) × 1014 cm−2 and (1.3 ± 0.4) × 1013 cm−2, and abundances of (8.2 ± 0.6) × 10−10 and (9.6 ± 3.0) × 10−11, respectively. Conclusions. The detection of n-propanol, together with the recent discovery of ethanolamine in the ISM, opens the possibility that precursors of lipids according to theories of the origin of life, could have been brought to Earth from outer space.