Carbon nanotubes might endure the enormous stress of an earth elevator but only short lengths have been manufactured so far.
It would be a mega engineering project that would dwarf earlier human endeavors. An earth elevator would need to extend at least to geosynchronous orbit at about 36,000 km altitude. And unless there were a truly enormous counterweight just beyond geosynch, it would have to extend well beyond geosynchronous orbit.
A problem not often considered is throughput. An Elevator car's mass adds to stress but not tensile strength, so we can't have too many elevator cars. And how fast will the elevator cars travel? They will most likely need their own power source.
We don't don't know the number of elevator cars or their speeds, but it's possible the small throughput wouldn't be sufficient to maintain the elevator, much less send humanity spaceward.
Another problem is orbital debris. At an altiude to 300 kilometers and above, the elevator would be passing through a debris cloud moving about 8 km/s wrt the elevator.
There are two quasi-stable regions that hover over fixed regions on the moon's surface. Earth Moon Lagrange 1 and Earth Moon Lagrange 2 (EML1 and 2). These hover over the moon's near and far points, respectively. Elevators from EML1 or EML2 would endure much less stress than an earthly elevator -- it's possible to make this from Kevlar rather than exotic materials like carbon nanotubes.
EML1 and 2 are about 60,000 km from the moon's surface. It would have to be even longer than an earth elevator. So throughput is also an issue with a lunar elevator.
Debris density in a lunar elevator's neighborhood is much lower than low earth orbit. So it is much less vulnerable than an earth elevator to random collisions.
Phobos has a minute gravity well and high angular velocity (a revolution each 7 hours, if memory serves). Like our moon, Phobos is tidelooked. The Mars Phobos L1 and L2 points hover about 3 kilometers over Phobos' surface. An elevator extending 10 or 20 kilometers beyond this points is sufficient to maintain tension.
A tether from Stickney Crater to Mar's upper atmosphere would be about 5600 km in length. Throughput is much less of an issue. The tether foot woud be moving about .6 km/s wrt Mars' surface. Small suborbital hops from Mars would suffice for foot rendezvous. A lander released into Mars atmosphere at .6 km's would suffer much less entry, descent and landing issues than the typical Mars lander entering at 6 km/s.
Going outward from Phobos: 2500 kilometers out the tether is moving Mars escape velocity. 6200 kilometers out this tether is moving fast enough for trans earth insertion. 8000 kilometers out, a Phobos elevator is moving fast enough for trans Ceres insertion.
Ceres and Vesta
Both these asteroids have shallow gravity wells and spin a lot faster than earth. So elevators could be much shorter and endure less stress.
Here's a chart from my space elevator page:
The top altitude column is how tall the elevator would need to be if there were no counterweight to provide tension. Taper ratio is ratio of tether thickness at synchronous orbit to tether thickness at surface.