I have seen the answer in this previous post. My question is as follows. Given a locally free sheaf $F$ over a connected scheme $X$. Why is it true that if $U$ and $V$ are two open sets in $X$ such that $F(U)$ and $F(V)$ are free $O_X(U), O_X(V)$ modules, respectfully, then their ranks are equal?
More simply, if the stalk of $F$ at a point $p$, $F_p$ is a free $O_X(p)$ module of rank $k$, why is there necessarily some open neighborhood $p\in U\subseteq X$, such that $F(U)$ is a free $O_X(U)$ module of rank $k$?
I am trying to think about this as follows. By taking an affine neighborhood of $p$ we can assume $X$ is an affine scheme. Taking generators $(m_1,U_1),...,(m_k,U_k)$ of $F_p$, and then defining $U=\cap_{i=1}^k U_i$, it becomes clear that $F(U)$ is not a free module of rank $n$ if there is a non-trivial combination of $f_i\in O_X(U)$, such that $\sum_{i=1}^k f_i\cdot m_i = 0$. Naively I would like to say that this implies the existence of a null non-trivial combination of the $m_i$ in $F_p$ by applying the restriction map from $U$ to $p$, but this argument is false, as the restriction map is not necessarily injective. I.e., $\rho_{p}^U(f_i)$ can be $0$ even if $f_i\neq 0$ in $O_X(U)$. Moreover, when I think about it, $O_X(U)$ can be comprised entirely of the $0$ section for all I know.
Thanks for reading.
You are working with the wrong definition of a locally free sheaf. The correct definition is that a sheaf $F$ is locally free if $X$ can be covered by open sets $U$ such that $F|_U$ is a free $O_X|_U$-module. This is stronger than the stalks being free modules (though it is equivalent under appropriate finiteness conditions, e.g. if $F$ is coherent).
In particular, for any such open sets $U$, the stalks of $F$ are free of the same rank (namely, the rank of $F|_U$ over $O_X|_U$) at every point of $U$. It follows that the rank of the stalks of $F$ is locally constant and thus constant since $X$ is connected.