It is not an easy thing to be an independent ride-hailing company these days.

For one, it takes billions of dollars and hundreds of employees to spread to new cities, to market the service and to recruit drivers. Legislators and local laws are often not in your favor. And competitors with deep pockets from all over the world are waiting to cheer if you happen to fail.

Lyft, the second-biggest ride-hailing company in the United States behind Uber, is grappling with those forces — but has found that its options are limited.

The company, which is based in San Francisco, has in recent months held talks or made approaches to sell itself to companies including General Motors, Apple, Google, Amazon, Uber and Didi Chuxing, according to a dozen people who spoke on the condition of anonymity because the discussions were private. One person said it was Lyft who was approached by interested parties.

Lyft’s discussions were most serious with G.M., which is one of the ride-hailing company’s largest investors. Still, G.M. never made a written offer to buy Lyft, said the people, and in the end, Lyft did not find a buyer.