Use fnm with read-only file system
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!
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?
Found another workaround which fits better for my use case by using tmpfs in docker compose:
tmpfs:
- /home/dev/.local/state/fnm_multishells