Example: A batter hits a single to the outfield, it is bobbled, so the batter can now reach second. The next batter is up and scores the runner on second. Since that runner reached second on an error and was in scoring position because of it, would that still be ruled as an earned run against the pitcher?
The definition of an earned run is one that would have occurred "without the benefit of an error or a passed ball." The official scorer attempts to reconstruct the inning as it would have played out without errors and passed balls, and only the runs that score in that scenario count as earned.
The scoring runner in your scenario may or may not have scored without the benefit of the error. MLB says "Often, it is the judgment of the official scorer as to whether a specific run would've scored without the defensive mishap." In this case if the official scorer thinks the runner would have likely scored from first on that single, it would be an earned run. This is unusual but possible, maybe in the case of a very fast runner or if the single was difficult to chase down quickly.
Of course if the next batter got a typical base hit, the run would almost definitely count as earned.