Lost in Space episode "Wish Upon a Star" from 1965 has Will and Dr. Smith finding a derelict alien spaceship and a mysterious machine which creates whatever they wish for.
They put a strange conical hat on their heads and whatever they wish for appears before them. Apples rain down from the sky, favourite foods pop out of thin air, even a collection of classical music tapes is not beyond its capabilities. Although nominally a popular science fiction series for youngsters, much of the science is much more akin to magic. Will and .Dr. Smith's alien machine is closer to Aladdin's magic lamp than physical reality.
Much science fiction is disguised magic where what is depicted is known to be nonsense. Dr Who's "sonic screwdriver" is a magic wand, Dr Who himself is a magician rather than a scientist. His TARDIS a magic phone box not entirely unlike Enid Blyton's Flyaway Cottage and equally nonsensical.
Captain Kirk's problems with dilithium crystals are problems with magic. Whatever dilithium is and whatever it is supposed to do, it has no connection with physical reality. It's an essential ingredient of the magic spells by which Scotty keeps the starship Enterprise on its magical journeys.
Not that there is anything wrong in presenting magic under the guise of science if the drama requires it. Magic has been with us for much longer than science and we aren't giving up on it without a fight, almost as if it has some hold over our genes and we can't let go.
Borderline magic is even more interesting. Economic predictions which owe as much to the crystal ball as they do to a world of real people coping as best they can without the benefit of magical foresight. From climate models to homeopathy, from the latest diet fad to sustainable energy, from the impossible exploits of James Bond to the mystique of the monarchy there is still a great deal of borderline magic in our system.