Given two free modules $R^n$ and $R^m$ over a commutative ring $R$, it's true that $R^n \cong R^m$ if and only if $n=m$. However every proof I've seen of this fact assumes that we've first proven it when $R$ is a field. Although this is probably true (most of us see linear algebra before commutative algebra), this sort of proof is a bit unsatisfactory to me.
Is there a (nice) proof of $R^n \cong R^m$ if and only if $n=m$ that doesn't assume we know it's true when $R$ is a field?
$\bf{Edit}$ Though the linked question implies a proof that does not use the result for $R$ a field, such an implication doesn't mean that the questions are duplicates of one another.