Error installing the flathub repository

I’m not able to install the flathub repository, I apply the command “flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo”, and I get the message
Note that the directory

‘/root/.local/share/flatpak/exports/share’

is not in the search path set by the XDG_DATA_DIRS environment variable, so
applications installed by Flatpak may not appear on your desktop until the
session is restarted.

erro: Ao abrir o repositório /var/lib/flatpak/repo: opendir(objects): Arquivo ou diretório não encontra

To me, that does not look like an error message.

It looks like an informative message telling you that you will need to logout and login again before you can use the repository that you just installed.

‘/root/.local/share/flatpak/exports/share’

Install the Repo as user:
https://en.opensuse.org/Flatpak

LOL.

I failed to pay attention to the “/root” at the start of that path.

And to the OP, to avoid such confusion in the future:
There is an important, but not easy to find feature on the forums.

Please in the future use CODE tags around copied/pasted computer text in a post. It is the # button in the tool bar of the post editor. When applicable copy/paste complete, that is** including the prompt, the command, the output and the next prompt.
**
An example is here: Using CODE tags Around your paste.

If you’ve not done so, be sure and delete the existing /var/lib/flatpak/repo directory prior to installing flatpak repo.

This worked on a new Leap 15.2 installation, not sure why it’s needed on a virgin system. Thank you.