For a noncommutative example, take R to be the triangular ring (~ ~) over a field k; both P = (~ ~ ) and Q = (~ ~) are projective right R-modules, and they are not free since any fg. free R-module must have k-dimension divisible by 3.

R=

kk
k0

P=

kk
00

Q=

00
k0