Let $(X,\mathcal O)$ be a ringed space. I am trying to prove that any $\mathcal O$-module that has an inverse with respect to the tensor product is locally free of rank $1$. I've found in Hartshorne a proof of the converse (i.e. any locally free sheaf of rank $1$ has an inverse), but not this.
Any hints?