There are two answers to this question.
1. The story answer by Orson Scott Card, best-selling author
As long as the story needs, but 75k-100k is when it starts to “feel” like a novel.
2. The selling it to editors answer by Jenny Rappaport, literary agent
“Aim for 80k minimum and 120k maximum. Try to hit as close to 100k as possible, but not go over. There are exceptions made for fat fantasies and longer novels.”
“For YA: 50k minimum. Try not to go over 75k. You can nudge it to 90k if it’s a fantasy. YA is a little more flexible.”
3. What happened to one author, Brandon Sanderson, when he tried to write to “the market”
As in stories less than 200,000 words…
BTW, Brandon is now New York Times best-selling author.