Skip to content

Add --install-if-missing option to fnm exec for missing Node versions #1487

@hzy

Description

@hzy

Problem

When running a command such as:

fnm exec --using=24.12.0 node -v

If the requested Node.js version is not installed yet, the command fails with the following error:

error: Requested version v24.12.0 is not currently installed

Proposal

It would be helpful to provide an option like --install-if-missing to automatically install the requested version if it is not present, similar to how fnm use behaves. This would improve the developer experience and reduce friction when running one-off commands using specific Node versions.

Example usage:

fnm exec --using=24.12.0 --install-if-missing node -v

This would install v24.12.0 if it is missing and then run the command as intended.

Motivation

  • Consistent experience across fnm exec and fnm use
  • Reduce manual installation steps
  • Useful for scripting and CI/CD scenarios

Thank you for considering this enhancement!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions