I was thinking about the Steampunk genre the other day, particularly Gibson's Difference Engine, and basically thought to myself; Steampunk is what would happen to the world if we didn't have electronics. This got me to thinking: what would lead to a world without electronics? Lack of a certain discovery, compound, or law of physics?
Failure of a successful invention of a lightbulb would most likely result in a lack of hollow-state devices (called "vacuum tubes" in the US, and "valves" in UK).
MOS technology was discovered in the 1920s, however the inability to refine semiconductors to the required purity was why MOSFET devices were not invented for half a century. "Tubes" are sometimes euphemistically called "glass FETs" as both vacuum tubes/vales and MOSFETs are voltage amplifiers. In contrast, transistors are current amplifiers.
The technology needed to refine semiconductors to the purity required were offshoots of the technologies that had to be invented for the Manhattan Project. So a world where there was no WW2, or no atom bomb project, would probably not develop the chemical refining processes needed to get the purity required for working semiconductors. No transistors would exist in such a world.
And at a far more fundamental level, it was Maxwell who discovered the links between electricity and magnetism. We humans live at temperatures where electricity and magnetism are readily convertible with each other: that electricity and magnetism are symmetrical and can be regarded as a single force called electromagnetism. Without his equations, relating electricity and magnetism would have been far more trial and error rather than the engineering that it has become. Too much colder, and one could not readily convert one to the other (generally, we call those areas "superconductivity").
And on a far more cynical level, based on how much technology had to be discovered, invented and developed for the Manhattan Project, the lack of crazy wild new technology shows that there are no UFOs at Area 51. Not just crazy new things to put into the UFOs, but the tools and machinery required to make those devices would need entire new industries. A look at the amount of effort that went into getting the titanium needed for SR-71s, as well as what tools had to be made to work with titanium is educational (most tools used for machine use are coated with cadmium - this causes extensive corrosion when used on titanium).
For an interesting history of technology, I recommend watching the series Connections.
First of all, this is not entirely true; steam was used to transport heat from some burning fuel to the engine, an was naturally replaced with engines with internal combustion -- this is a very natural and logic consequence of improving steam technology, so I think this step was almost inevitable. On the other hand, we still depend on internal combustion (with cars as a most lurid example), nevertheless of electrification of most other machines.
The other (and in fact orthogonal) aspect of steampunk are the mechanic realizations of electronic stuff -- this is a it more probable if one assumes that for some reason electricity was not invented or rejected for some reason (religion?). Although it is definitely not a stable alternative since (paradoxically) mechanical technology requires much more complex designs, huge precision in making parts (this is the reason why Babbage computer failed) and is just very slow.
I always got the impression that it happened because of a lack of progress. Electricity in Steampunk tends to be treated as an oddity, not a tool. Otherwise, it's treated as something cold and impersonal, whereas steam and mechanics are more "human".
It seems like the main reason electricity isn't used is because there are no transistors. You can usually find more primitive things like switches, capacitors, and large (inefficient) generators, but good batteries and transistors always seem to be missing (an example would be Mortal Engines).
You also made a good point about physics. In stories like Terminal World, the different "zones of technologies" make it a physical impossibility for electrical devices to exist in some places.
Just the absence of some rare elements used in semiconductors such as Gallium can be the reason behind the setback of the advent of solid state electronics.
For vacuum tubes, you would need another excuse, as any conductor can become an electrode with varying degrees of efficiency. Perhaps Earth is experiencing a severe solar storm (yet unknown to people) that will last for a century or two, so any baby steps in electronics are bound to fail due to severe interference, and any attempts at developing electronic components are written off as chaotic, unstable and unpredictable as a result.
In Alastair Reynold's Terminal World, one of the theories about the "zones" is the "grid" on which matter is arranged changes from zones to zones, so that in some zones you cannot make certain connections or atomic placements needed for higher end biological/chemical/mechanical interactions.
While the book mostly talks about how stuff stops working, it seems like there's something about the physical organization of matter which would either prevent electricity from "flowing", or at least from correctly operating in circuits.
Only certain zones (such as "circuit city" region of Spear Point) can support electronics.
In a hypothetical alternate universe Electronics could have not arisen because it was seen as unclean or unholy. A single Papal decree declaring the use of electricity to be the work of the devil would suffice. Perhaps there is a deeper reason for this, maybe the catholic church is heavily invested in the coal industry which fuels the steam technology? Or maybe they just think it's evil.
Also innovation comes from a need for innovation, if steam based solutions exist for problems that could be solved by electricity then the development of electricity would be stunted. The only thing I can think of that can't be done with pure steam is generation of light, but you have gas lanterns for that. You can even make a computer that operates on steam, arguably it would be a lot slower than the electronic ones we have today.