The answer is both. The term “Alp” in “nightmare” does not refer to the pasture ground in the mountains, but rather to the Alp or Alb from Germanic mythology. In its original name, the Alp or Alb is an eleven, a treacherous creature that causes heavy dreams and causes feelings of anxiety because it sits on the sleeper’s chest.
The well-known dictionaries give different recommendations for writing: Duden for the “b” variant: Nightmare, True for those with “p”: Nightmare. Whatever spelling you choose, consistency is important.
If in doubt, please consult the Apostroph Group’s language experts. We check, correct and edit your texts with a keen eye.