Schniz / fnm

🚀 Fast and simple Node.js version manager, built in Rust
https://fnm.vercel.app
GNU General Public License v3.0
18.05k stars 460 forks source link

Use fnm with read-only file system #1198

Open Bessonov opened 3 months ago

Bessonov commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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

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