Making solar panels is not carbon free. Making batteries instead of emitting gases is not carbon free. We still have to recycle those panels and those batteries and take in account the impact of it.
I feel like we are changing the place where gases are emitted or residues stored instead of making less cars, consuming less in general, etc.