First, make sure nothing is truly "wrong" or that she is not acting out because maybe something happened to her at school etc. Talk with her.
Second, she told you she's afraid of the dark and being alone. So, you need to respect her feelings and appreciate that she can even express herself to you. A child NEEDS to know that their feelings are Validated...thus, they can trust the Parent as well and know that they are being heard and can share their feelings without judgment.
Third, there is no reason to "punish" her for being afraid of the dark. It will NOT work. My girl is 5 going on 6 years old... she is ALSO afraid of the dark, or of the noises outside, or of sleeping by herself too. For us, once my girl knows that she is comforted by us, and that she is "safe" and Daddy goes outside to check the noises (he does this to assure our girl & doesn't mind), then she rests and sleeps better. Sometimes, she will come in our room, and sleep on the extra futon we have in our room, or on the floor. We don't mind.
It is a phase. On and off, from the time our girl was a toddler, there would be times when she is just afraid of the dark. It's normal. My friends kids are the same way.
She may just be needing you more now... and feels alone. An "elder" child has a LOT to adjust too as well.... they often feel lots of pressure on them, being the oldest, that they have to be "perfect" and can't be a "baby" anymore, and have to always "help" the younger baby, and help and do everything more...since they are the oldest. Elder children have a lot of "responsibilities" and "expectations" put upon them...whether or not they are ready.
Sometimes a child can ALSO have stress.... I know a child that this happened too and it was very sad... this child told me all this, and she was 7 years old as well & had younger siblings. But, she refused to talk with her parents because she said "they never listen to me anyway... and I get blamed for everything...." She had lost all trust and hope in her Parents that they would be there for her.
Not saying this is you. But, kids are tender... even if it seems irritating to us... they need what we are not providing sometimes.
Unless your girl has not been through anything traumatic lately, or if anything at school or friends are not bothering her....then, it is probably just a childhood phase they go through. At this age, they STILL get afraid of the dark. I know I did as well, at that age.
Perhaps, ask her teacher how things are at school, with your girl or if anything is wrong there as well? Or ask the teacher about what is going on...
All the best,
Susan