Every $R$-module is free $\implies$ $R$ is a division ring From Grillet's Abstract Algebra, section VIII.5.

Definitions. A division ring is a ring with identity in which every nonzero element is a unit. A vector space is a unital module over a division ring.
Theorem 5.2. Every vector space has a basis.
Exercises. 
(7.) Show that $R$ is a division ring if and only if it has no left ideal $L \neq 0, R$.
(*9.) Prove that $R$ is a division ring if and only if every left $R$-module is free. 

I'm trying to solve exercise 9. I suspect it should be formulated: 

Let  $R$ be a unital ring. Then $R$ is a division ring $\iff$ every unital left $R$-module is free.

Attempt of proof: $(\implies)$: Theorem 5.2.
$(\impliedby)$: By exercise 7, it suffices to show that every non-zero left ideal of $R$ is equal to $R$. Let $I\!\neq\!0$ be a left ideal. As a $R$-module, $I$ has a basis $B$. 
How can I show that $I=R$?
 A: Cite planetmath:

Assume now that every left $R$-module is free. In particular every
  left $R$-module is projective, thus $R$ is semisimple and therefore
  $R$ is Noetherian. This implies that $R$ has invariant basis number.
  Let $I\subseteq R$ be a nontrivial left ideal. Thus $I$ is a
  $R$-module, so it is free and since all modules are projective
  (because they are free), then $I$ is direct summand of $R$. If $I$ is
  proper, then we have a decomposition of a $R$-module $$R\simeq I\oplus
I',$$ but rank of $R$ is $1$ and rank of $I\oplus I'$ is at least $2$.
  Contradiction, because $R$ has invariant basis number. Thus the only
  left ideals in $R$ are $0$ and $R$. Now let $x\in R$. Then $Rx=R$, so
  there exists $\beta\in R$ such that $$\beta x=1.$$ Thus every element
  is left invertible. But then every element is invertible. Indeed, if
  $\beta x=1$ then there exist $\alpha\in R$ such that $\alpha\beta =1$
  and thus $$1=\alpha\beta=\alpha(\beta x)\beta=(\alpha\beta)x\beta=x\beta,$$ so $x$ is right invertible. Thus
  $R$ is a divison ring. $\square$

A: Look at the $R$-module $R/I$. Show that it can't have a basis.
A: I will paraphrase Pete Clark's "Commutative algebra" notes (pp. 24-25), available here.
As Julian's answer and Amitesh's comment point out, if $R$ is a commutative ring, then if $R$ was not a field, there would exist a two-sided proper ideal $I$. Then  $R/I$ would be a nontrivial $R$-module with $0\not=I=ann(R/I)$, whence $R/I$ would be a nonfree $R$-module.
For the noncommutative case: a ring with no nonzero proper twosided ideals may admit a nonfree module. Prof. Clark constructs an example: I quote,

Noncommutative Remark: If $R$ is a non-commutative ring such that every left $R$-module is free, then the above argument shows R has no nonzero proper twosided ideals, so is what is called a simple ring. But a noncommutative simple ring may still admit a nonfree module. For instance, let $k$ be a field and take $R = M_2 (k)$, the $2\times 2$ matrix ring over $k$. Then $k\oplus k$ is a left R-module which is not free. However, suppose $R$ is a ring with no proper nontrivial one-sided ideals. Then $R$ is a division ring – i.e., every nonzero element of $R$ is a unit – and every $R$-module is free.

At the end he asserts what you have been trying to prove. As mentioned by him in the comments, this is expanded in his noncommutative algebra notes, p.6:
Every left $R$-module is free $\Rightarrow$ $R$ is a division ring:

(We follow an argument given by Manny Reyes on MathOverflow.) Let $I$ be a maximal left ideal of $R$ and put $M = R/I$. Then $M$ is a simple left $R$-module: it has no nonzero proper submodules. By assumption $M$ is free: choose a basis $\{x_i\}_{i\in I}$ and any one basis element, say $x_1$. By simplicity $Rx_1 = M$. Moreover, since $x_1$ is a basis element, we have $Rx_1 \cong R$ as $R$-modules. We conclude that as left $R$-modules $R\cong M$, so $R$ is a simple left $R$-module. This means it has no nonzero proper left ideals and is thus a division ring.

A: Here is a different answer, but it is much less elementary.  If every module is free, then every module is projective, so every module is semi-simple, and the ring is an Artinian semi-simple ring, so a direct product of matrix rings over division rings.  Clearly any ring direct summand is a projective non-free module, so we have a matrix ring over a division ring.  However, the natural module is a projective non-free module unless the matrix ring is of degree 1, that is, unless it is already a division ring.  In other words, apply Artin–Wedderburn theory.
A: Note: As Jack Schmidt points out below, this doesn't actually work for a noncommutative ring:
Alternatively: assume that $R$ is not a division ring. Select a nonzero non-unit $a\in R$ and adjoin an inverse of $a$ to $R$. Then $R[a^{-1}]$ is a non-free $R$-module.
