In addition, dark nights, locked rooms, empty stairs and hidden corners will make you curious and afraid because of mystery. Some subconscious thinking activities are suppressed because of reality and will be released in dreams.
You can be sure that you are afraid of ghosts, and you are not sure to beat them, so when you realize your wish to see ghosts, you can do nothing until you wake up.
I have dreamed of ghosts before, and they usually appear on the balcony (there is a big cabinet on my balcony) and on the stairs. I just ran and couldn't move (unlike your subconscious reaction) ~
Relax, divert your attention and breathe the beauty of this world. It's okay.