Treatment of primary alkyl bromides or iodides with 1.5–3 equivalents of sodium nitrite, at room temperature, in PEG400 as solvent, allows the chemoselective formation of primary nitroalkanes in satisfactory to good yields, under ecofriendly reaction conditions.