Let $X$ be a scheme and $\mathcal{F}$ be quasi-coherent module on $X$. It is clear that if $\mathcal{F}$ is locally free of rank $n$, then $\det(\mathcal{F}) := \wedge^n \mathcal{F}$ is invertible, i.e. locally free of rank $1$. But what about the converse?
Question. Assume $\wedge^n \mathcal{F}$ is invertible. Does it follow that $\mathcal{F}$ is locally free (necessarily of finite rank $n$)?
Of course we may assume that $X$ is affine. Then it is enough to prove that $\mathcal{F}$ is flat and of finite presentation, but I don't know how to prove either one. Also it seems to be hard to find counterexamples.