Light and sound are two different types of waves. Light can travel through vacuums and outer space, and sound needs a medium to travel in and cannot be heard in a vacuum.
Waves are classified into two types depending on the direction in which the energy travels relative to the components of the wave. Electromagnetic waves have an electric and a magnetic component that vibrate perpendicular to each other. The wave itself moves in a direction perpendicular to both components and can travel through vacuum, gases, liquids and some solids. Mechanical waves move parallel to the direction in which the particles vibrate and require a medium to travel in. This means mechanical waves cannot move in the absence of molecules.
Light is an electromagnetic wave and does not require molecules to travel from its source. This allows light to travel through the vacuum of space. Sound is a mechanical wave and requires a medium to travel in. If there are no molecules present to vibrate and propagate the energy, sound cannot be heard, which is why sound cannot be heard in outer space. It is because light can travel through space that we can see the sun, moon and stars. We can also see the remnants of exploding stars, but since sound cannot travel through space, we cannot hear any of the events occurring in space.