To give you an example, think of a way to run a large aluminium smelter overnight using just solar cells. There isn't any sun shining, so you arn't getting any power in. You need to somehow store enough energy to run the plant overnight, and do it in a form that can actually be produced, isn't absurdly expensive and isn't utterly dangerous.
And at the end of that, you need enough solar cells to produce enough power so that your countries economy doesn't stop in the first spat of bad weather.
I do agree with your point, however. Fossil fuels cause too much damage to the environment for them to be viable long term.
The only question is how do we go about replacing them, with the current political state of the issue?