First off, they only work when there is light. Cloudy days they do not produce the full amount of electricity they are rated for.
Since the electricity can not be stored, batteries are needed to have electricity at night, which cost about as much as the solar system, and add to the maintenance costs.
Solar panels begin to loose efficiency the minute they are exposed to light. At the end of twenty years, they produce very little power. The average output over twenty years is about 60% of the rated power output.
The panels need to be washed and cleaned of debris and dust weekly and sometimes daily to get the full power output possible. Light dust can drop efficiency by about 10% or more.
The average mean cost for having solar power not including batteries, is about 18 times the cost of using the conventional electric grid, at about $1.80 per KWH. Solar is only cost effective when used in remote areas where it is too expensive to run electric transmission lines. If batteries are used, the average cost is about 31 to 36 times the cost of using the grid, about at $3.10 to $3.60 per KWH. Using the grid, the average cost is about $0.10 per KWH.
If solar panels are used in areas with tornadoes or hurricanes, flying debris damages the panels, and they need to be replaced.
I am a contractor since 1978, and even at wholesale cost and installing them myself, solar electricity is too expensive.