I absolutely agree that in the long term they’re a much better option. But my drag-around gas generator cost 500 bucks, while my solar system was $22k and I got quoted $18k for a single battery.
If we're talking long-term, the generator will easily outlast the solar panel and/or battery if you maintain it properly (which is honestly very trivial as upkeep goes).