Definition 1.
Let $R$ be a ring with invariant basis number and $M$ be a free $R$-module.
Then, the rank of $M$ is the cardinality of an $R$-basis of $M$.
${}$
Definition 2.
Let $R$ be an integral domain and $M$ be a finitely generated $R$-module.
Then, the rank of $M$ is the maximum number of $R$-linearly independent elements of $M$.
If a module is free, these two definitions coincide, but if a module is not free, Rank(Def1) cannot be defined. Moreover, I'm not even sure whether Rank(Def2) is well-defined.
Is there another terminology to designate the Rank(Def2)?
And why is Rank(Def2) well-defined? Is every cardinality of a $R$-linearly independent subset of a finitely generated $R$-module finite? Or is Rank(Def2) defined as the maximum number of finite linearly independent subsets of $M$?
It's an easy exercise to show that Rank(Def2) is equal to $\dim_K(K\otimes_RM)$, where $K$ is the field of fractions of $R$. This shows that Rank(Def2) is well-defined, and this is by definition the rank of $M$ in such context.
"Is every cardinality of a $R$-linearly independent subset of a finitely generated $R$-module finite?" Yes, it is. In fact its cardinality is less or equal to $\dim_KK\otimes_RM$.