Why?
Except for the ability to hammer an object at the limits of line of sight in seconds, why do you need a rail gun on a navy ship?
They do not have the rate of fire to make them very useful unless you can guarantee a hit on the first shot. If you cant the slow rate of fire makes you vulnerable as the object closes range.
It is a shame that they canceled the long-range support gun for the Navy. The longest ranged conventional gun the navy had for decades were the 16-inch guns on the battleships. While devastating in use, the powder bags used to fire them were a major hazard as seen by the 1989 USS Iowa explosion.
Until a few years ago the navy had been working on a liquid propellant weapon that would fire a round over twice the range the old 16s could. By varying the trajectory and amount of propellant it could fire multiple rounds from one gun barrel and have them land virtually simultaneously covering a large area in one big explosion.
The liquid propellant was supposed to be safer to store than the powder used by any past or present large caliber weapon in the Navy. I am not sure why, but the project was cancelled.