Solanine is produced when potatoes are subjected to light. Even fluorescent lighting found in your favorite food shopping establishment.
Potatoes grow under ground. As the plant matures we pile up soil around the plant to "hill" them. This protects the tubers and enables them to develop and not poke out of the ground.
Heavy irrigation and rains can wash your "hill" to uncover potatoes near the surface so cover 'em back up if this occurs.
If consumed in large quantities Solanine is toxic. That's why its important to cut away any green portions of a potato before you cook and consume.
Remember to store your potatoes out of exposed light to cut down on the Solanine.