I am trying to look at smooth manifolds in the context of locally ringed spaces. Vector bundles have a characterization in terms of sheaves of modules: if $X, \mathcal{O}_X$ is a topological (or smooth) manifold along with its structure sheaf, then a locally free $\mathcal{O}_X$ module of rank $n$ is the same thing as a vector bundle over $X$ of rank $n$. You can read about the correspondence in Ramanan chapter 2, for instance.
Now forget about manifolds for a second, and suppose that $X, \mathcal{O}_X$ is just a locally ringed space, where all the stalks have residue field $\mathbb{R}$, and that $\mathcal{E}$ is a locally free $\mathcal{O}_X$ module, and suppose I try to form a vector bundle out of it, in the same way mentioned in the link above.
My Question: Given a locally ringed space $X, \mathcal{O}_X$, where each stalk has residue field $\mathbb{R}$, and an $\mathcal{O}_X$ module $\mathcal{E}$ which is locally free of rank $n$, how can I construct a vector bundle from this information?
Here is my attempt, and you can see where I run into problems.
Attempt 1: (Via a basis) I'm trying to define a topology, so I may as well work locally. After passing to a smaller open set, I can assume that $\mathcal{E}\cong (\mathcal{O}_X)^n$ as $\mathcal{O}_X$ modules. (Then later I should worry about transition functions and stuff, but you'll see I don't even get that far.)
As a set, my vector bundle $E$ will be the elements $\bigcup\limits_{x\in U} (\mathcal{E}_x/\mathfrak{m}_x\mathcal{E}_x)$, where $\mathfrak{m}_x \triangleleft \mathcal{O}_{X, x}$ is the maximal ideal. Now I topologize it by taking a basis for $\mathcal{E}$: suppose $\mathcal{E}(X)$ has a basis over $\mathcal{O}_X(X)$ given by $\mu^1, \dotsc, \mu^n$, and suppose I take as my basis for each $\mathcal{E}_x/\mathfrak{m}_x\mathcal{E}_x$ the images of $\mu^1_x, \dotsc, \mu^n_x \in \mathcal{E}_x$. Now I have specified a bijection $a: U \times \mathbb{R}^n \to E$, and I can thereby put a topology on $E$, by declaring this to be a homeomorphism. (If I want to define a smooth structure on $E$, I can declare this to be a diffeomorphism.)
Is this topology the same if I select a different basis? If I choose $\nu^i$ as a basis, then $\nu^i = \sum_j f^{ij} \mu^j$ for $f^{ij} \in \mathcal{O}_X(U)$. I ask myself whether the map $$\mu_x \mapsto \sum_j \overline{f}^{ij}_x \mu_x$$ defines a self-homeomorphism from $E \to E$. (Here $\overline{f}^{ij}_x$ represents the image of $f^{ij}_x$ in $\mathcal{E}_x / \mathfrak{m}_x\mathcal{E}_x$.)
In the case where $X$ is a manifold, and $\mathcal{O}_X$ is its sheaf of continuous (smooth) real-valued functions, then the $f^{ij}$ really are continuous (smooth) real-valued functions on $X$, and the above map $E \to E$ seems pretty clearly to be continuous (smooth). But in the general case, where $X, \mathcal{O}_X$ is just a locally ringed space, I don't really know how to interpret the above map. (Why is it continuous on the topology I've defined? I can define values for $f^{ij}$ in each $\mathcal{O}_{X,x}/\mathfrak{m}_x$, but what do they really have to do with each other?)
What I suspect is going wrong: The spaces $\mathcal{E}_x/\mathfrak{m}_x \mathcal{E}_x$ at each point are all isomorphic to $\mathbb{R}^n$, but they don't have any canonical isomorphisms between them. To put a topology on $E$ I have to kind of decide on these canonical isomorphisms, and I can't just do it in any old way I want--the elements in the structure sheaf have to have something to do with continuous functions $X \to \mathbb{R}$ for this to work.
Attempt 2: (Basis free) (Suggested by a friend): (Edit: I don't think this works. As Eric Wofsey points out, the fibers would all be discrete.) Take $\mathcal{E}$, and form its etale space $\operatorname{Et}(\mathcal{E})$. The elements of the etale space are just all the germs. Let me describe a relation on germs by saying that two germs $\mu_x, \nu_x$ are related if they are in the same stalk and $\mu_x - \nu_x \in \mathfrak{m}_x\mathcal{E}_x$. Now just form the quotient topology by this relation.
If I do this in the case where $X, \mathcal{O}_X$ is a manifold with its ring of smooth functions, it seems to give me the correct topology on $X \times \mathbb{R}^n$. So perhaps it works as a basis-free construction?
Here are some related questions, but they don't really address my question: 1, 2, 3, 4.