Snap install not working

I’m doing snap install code --classic and this is the result:

error: cannot communicate with server: Post "http://localhost/v2/snaps/code": dial unix /run/snapd.socket: connect: connection refused

Help please!

Is snapd’s service and socket running? You can find out by running this in the terminal:

systemctl status snapd.service snapd.socket