Earlier quoted context omitted.
It's not like the technology behind railguns hasn't been stable and ready to use for decades now. It's just that, until the more recent invention of ancillary technologies like supercapacitors, it's been so costly to fire them that there was no logical place for them on the battlefield, so we never bothered to operationalize them.
I'd be interested to know why we haven't seen intermediaries that don't need the advanced tech of a rail gun, like why haven't we seen magnetically driven mortars or artillery? These seem less demanding, is it just a case of existing tech being good enough?
On ships and airplanes, you can replace internal weapons bays which have substantial storage capacity. And the batteries (this is particularly an issue for airplanes) aren't terribly mass-dense either. And you can use the vessel's turbine-powered electric generators to recharge the batteries from fuel (this reduces the range, but hey, tankers).