Cannot connect to ipfs cli installed from snap

I have installed ipfs cli via snap on Ubuntu and have run ipfs init and ipfs daemon. However, I cannot get IPFS desktop to connect to my cli node. I have installed both the appimage and the ipfs-desktop snap but both report “Could not connect to the IPFS API” when I run them.

I was thinking ipfs desktop was pointing to the incorrect repository so I tried to point it at the ipfs cli snap location (for some reason the repo is created at ~/snap/ipfs/common which I’m guessing is some kind of sandboxing going on; setting IPFS_PATH has no effect on this path), but without success. the AppImage changes without issue but I still get the “Could not connect to the IPFS API” error. Trying to change the repo dir from the snap version results in a permission denied error.

My understanding is that IPFS desktop will just connect to a running node if it exists and will only install its own node if the ipfs cli daemon is not running. As an aside, I can access the ipfs daemon from a web browser using both the IPFS companion for FF and from the url localhost:5001.

Okay I took a different route and installed the zip version of IPFS CLI for Linux. I successfully initialized my node and have it running. However, if I try and connect via localhost:5001/ipfs I get:

Could not connect to the IPFS API

However, if I run on it works.

This means IPFS Desktop cannot connect to my cli node. I applied the fixes but didn’t do anything:

ipfs daemon
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["webui://-", "http://localhost:3000", "", ""]' $ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST"]'

but without success.

So I was able to solve this with the following:

  • Remove all snap installs; ipfs and ipfs-desktop,
  • Install Go IPFS using the tar.gz.
  • ipfs init
  • ipfs daemon
  • Install IPFS Desktop

IPFS Desktop appears to connect to the snap/ipfs dir (maybe this was left over stuff) so “Advanced → Open Configuration File” and change ipfsConfig → path to ~/.ipfs. Save and close.

This got the IPFS Desktop working for me. I’m not entirely sure I understand how Desktop works because I would have thought it would just communicate with daemon using the api. However, it seems to need to have the daemon running AND have the config path configured correctly.