fnm icon indicating copy to clipboard operation
fnm copied to clipboard

error13 when running as a non-root user

Open blainehuang1028 opened this issue 2 years ago • 1 comments

I tried to install Ghost Blog CMS and it required node.js. SO I decided to use fnm. But Ghost can't install in root user, so I install fnm in both root user and "blog" user. In root fnm runs perfect, but in non-root user, it cant install node

blog@vultr:/root$ fnm install 16.14.0 Installing Node v16.14.0 (x64) error: Can't download the requested binary: Permission denied (os error 13) blog@vultr:/root$ sudo fnm install 16.14.0 sudo: fnm: command not found

blainehuang1028 avatar Mar 11 '22 18:03 blainehuang1028

I see two errors.

The first one is related to permissions: please share your $FNM_DIR for the blog user--I think this is what the issue. Make sure that you have read/write permissions to that directory. You can set it yourself with the --fnm-dir=... flag in the fnm initialization

$ echo $FNM_DIR
$ ls -lah $FNM_DIR

The second one is a shell error. "command not found". Please make sure the binary is reachable for sudo to understand. You can try doing that with sudo $(which fnm) install 16.14.0--which will force it to use the current fnm binary. Anyway, it's a shell config thing and not fnm-specific.

Schniz avatar Mar 14 '22 12:03 Schniz