"Je ne la voyais pas pendant des années."
Wouldn't this translate more to: I was not seeing her for years?
I thought you would use depuis when it related to the present.
The correct translation of "I have not seen her for years", in French is: "Je ne l'ai pas vue depuis des années" (Duolingo is wrong) OR "Je ne la vois pas depuis des années" (re. context).
"I was not seeing her for years" is "Je ne l'ai pas vue pendant des années".
Maybe something far fetched if this sentence is complemented with another bit of story, like: "pendant des années, je ne la voyais pas, je ne lui parlais pas, mais je pensais à elle".
"For years I wouldn't see her, would not talk to her but I would think about her"
you have certainly noticed that I put "pendant des années" at the beginning; it is a way to have the whole think hold together.