fnm icon indicating copy to clipboard operation
fnm copied to clipboard

Use fnm with read-only file system

Open Bessonov opened this issue 1 year ago • 2 comments

I use fnm in Docker with a read-only file system. fnm is installed in a read-write mounted directory /home/dev/app/.cache/fnm and FNM_DIR is set to /home/dev/app/.cache/fnm.

However, fnm env still tries to create a folder in ~/.local, which leads to the error: Can't create the symlink for multishells at "/home/dev/.local/state/fnm_multishells/8_1721624544201".

Setting FNM_MULTISHELL_PATH to /home/dev/app/.cache/fnm/multishell didn't help. How can I change the path? I am using ubuntu:22.04/bash if it matters.

Thank you!

Bessonov avatar Jul 22 '24 05:07 Bessonov

Digging further in the source code, I found a workaround by setting XDG_RUNTIME_DIR:

XDG_RUNTIME_DIR=/home/dev/app/.cache/fnm/runtime fnm env

Is this the way?

Bessonov avatar Jul 22 '24 05:07 Bessonov

Found another workaround which fits better for my use case by using tmpfs in docker compose:

    tmpfs:
      - /home/dev/.local/state/fnm_multishells

Bessonov avatar Jul 22 '24 10:07 Bessonov