Why did the former SSR countries like Lithuania, Estonia, and Latvia face no trouble from Russia to join NATO and EU, while countries like Georgia and Ukraine facing Russian military invasions?
There are several reasons.
Lithuania, Estonia, and Latvia don't pose as significant strategic geopolitical threat as invasion route. Ukraine and Georgia do.
I covered the geopolitical motifs that drive Russia (the need to protect itself from invasion from West/Southwest/South due to lack of defensible natural borders) in another Politics.SE Q&A.
The following map illustrates the differences very nicely (hand drawn red squiggles mine). You will note that:
Latvia has a very small border with Russia, that's easier to defend, and further from Moscow. Lithuania has no direct border (Kaliningrad/Königsberg is irrelevant from this viewpoint). Estonia's border is more defensible due to water except for small area near Narva.
Ukraine has a huge ass-border, right near the best route to invade to Moscow from Europe (if you discount Belarus, which is firmly with Russia for now)
Georgia not only has a big border, it's also near Ossetia/Chechnya, which are... sensitive spots for Russia security wise
Similarly, Baltic republics don't offer much of a significant geopolitical value to Russia, comparatively.
They aren't resource rich (unlike Ukraine with its hydrocarbon resources or Georgia with all the resources in Caucasus region).
They don't offer great agriculture (being in the colder North; baltic area) unlike Ukraine and Georgia.
Baltic republics have strong affinity for Western Europe, and strong dis-affinity for Russia; for historical, cultural, and religious reasons. The effort to keep them out of Western orbit and in Russia's is much harder.
They were the very last republics that were forced to join USSR. They were the very first ones to want to separate from USSR. Most of Russian speaking population there are not indigenous. Their culture is largely that of Western Europe.
In contrast, Ukraine has an north-eastern region that is historically and culturally Slavic/Russian.
As far as Georgia, it has less affinity with Russia, but bullet points #4/#5 compensate for that.
Next two bullet points are kind of in reverse, in that they cover "why isn't NATO gung-ho to accept them"; but the fact that NATO is not gung-ho is precisely why Russia can afford to contest them more strongly as influence.
Georgia is very hard for NATO to defend. Professionals study logistics, remember? Georgia is at the end of a super long supply line, going through Turkey (which may not be in NATO much longer anyway).
NATO doesn't want either Georgia nor Ukraine as of right now as members, regardless of Russia.
Economically and partly politically, they aren't in the position to fit NATO requirements. (this can be elaborated on into a whole separate answer, if you're curious please ask as a separate independent question)
As someone noted in comments, even if Russia wanted to contest Baltic republics joining NATO, they weren't in a position to do so back then (2004) - Russia was just barely starting to try to recover from economic collapse of 1990s and political volatility.
Somewhat affecting both #1 and #2, water resources (both as far as invasion routes, AND as economic benefits).
Baltic republics have bleargh Baltic sea (and Russia already has access to Baltic as needed anyway).
Georgia and Ukraine have Black sea.
The naval base in Crimea is Russia's only warm water port.
Because they have their most important naval base there, there are many Russians in Crimea.
Once they already invaded Crimea, there was less preventing an invasion of eastern Ukraine, which also has a significant Russian population. I.e. they got away with Crimea, so it seemed like they could get away with eastern Ukraine.
Russia felt less secure about protesting in 2004 than in 2014.
Russia was already contesting Georgia and could not contest both sides.
Estonia, Latvia, and Lithuania are naturally limited. Of nearby countries, only Finland would be considered part of the old Soviet sphere.
Georgia gets NATO to Azerbaijan. Together, Georgia and Azerbaijan would block off that section of land and Russia ally Iran.
Azerbaijan would also give NATO access to the Caspian Sea, which leads to places like Turkmenistan, etc. From Russia's point of view, Georgia could be the start of a domino effect that would leave them surrounded by NATO and China.
Georgia borders rebellious parts of Russia (e.g. Chechnya), which might themselves want to leave Russia and join NATO.
It's also possible that events in eastern Ukraine weren't entirely managed by Russia. Obviously they encouraged the organization of the separatists, but it is unclear if they were actually able to assert control. The separatists did things against Russia's public utterances. While this could have been a Russian plan, it could also indicate that they didn't control the rebels. They may have been stuck with either supporting or abandoning the rebels, and they didn't want to abandon them.
From the outside, it is very difficult to tell if the rebels were listening to Putin's private utterances or not. Particularly considering that if they were, then having his private and public statements differ was an intentional strategy.
In general, we don't know if Russia tried to whip up an Estonian separatist movement. Maybe they did but failed. Maybe thinking about what they could have done in Estonia gave them ideas for Ukraine. Maybe Russians in Ukraine are more concentrated in the eastern regions and more spread out in Estonia. Maybe there are simply more Russian army personnel in eastern Ukraine than in Estonia. Maybe the importance of Crimea led them to build a distraction in eastern Ukraine that got out of control.
I'm not quite sure about Georgia, but as far as Ukraine is concerned this is what I know:
Ukraine is simply much more important for Russia in terms of building a new empire. Such a new empire might be built without the three Baltic countries but never without Ukraine. Ukraine's migration to the West is the death for Russia as an empire. This is why Russia did what it did to my country