Nightmares in children are commonly seen . It indicates some sort of fear in them. In adults nightmares come when they go through tremendous stress . In older person it could be part of a neurological disorder. But overlap is seen across the age. So person's age is important and needs an evaluation to understand the condition/ situation. Solution is available after diagnosing the problem.
Next Steps
If the nightmares are ongoing problem, consult a mental health professional.
Health Tips
Going to sleep with pleasant thoughts will help to some extent