fnm icon indicating copy to clipboard operation
fnm copied to clipboard

Can `--install-if-missing` be added to `fnm env` so that `--use-on-cd` can work without prompting

Open nemchik opened this issue 5 months ago • 1 comments

Currently with fnm env --use-on-cd

  • If I cd into a directory that has a file defining a node version I do have, this works as expected by switching to the node version defined.
  • If I cd into a directory that has a file defining a node version I do not have have, I am prompted to install that version.
    • Correction: After the install is complete it is not automatically used.

I would like:

  • If I cd into a directory that has a file defining a node version I do not have have, I would like fnm to automatically install and use that version without prompting me.

I imagine this behavior is not wanted by everyone, so I'm hoping this can be a separate flag so that people can opt to use it.

nemchik avatar Aug 01 '25 14:08 nemchik

My solution for now, if that can help:

eval "$(fnm env --use-on-cd --shell zsh | sed 's/-unchanged/& --install-if-missing/')"

Isos9 avatar Dec 09 '25 23:12 Isos9