Is your feature request related to a problem? Please describe.
When running moon docker setup inside a Docker container that already has the exact Node.js version Moon is configured to use (e.g. using an official node:20 base image), Moon still downloads and installs Node.js through proto. This is redundant — it slows down Docker builds and adds ~200 MB of bloat to the image since Node.js ends up installed twice.
The current workaround is MOON_TOOLCHAIN_FORCE_GLOBALS=node, but this is all-or-nothing — it unconditionally skips installation with no fallback. If the system binary is missing or the wrong version, commands will fail at runtime.
Describe the solution you'd like
Before downloading/installing a toolchain, Moon should check if a matching version already exists on the system PATH. If the system binary satisfies the configured version requirement, skip the proto installation and use the system binary directly.
This could work as a new option, for example:
# .moon/toolchain.yml
node:
version: "20.0.0"
preferSystemBinary: true # Use system node if it matches the version
Or it could be an additional mode for MOON_TOOLCHAIN_FORCE_GLOBALS, e.g. MOON_TOOLCHAIN_FORCE_GLOBALS=node:prefer meaning "use system if available and matching, otherwise install."
Describe alternatives you've considered
MOON_TOOLCHAIN_FORCE_GLOBALS=node — works but has no fallback if the system binary is missing or wrong version. It also doesn't verify the version matches.
- Pre-installing the version in proto's cache before running
moon docker setup — adds unnecessary complexity to the Dockerfile.
Additional context
This is especially relevant for Docker workflows where base images already bundle the correct runtime. Avoiding a redundant download would improve build times and reduce image layer size.
Is your feature request related to a problem? Please describe.
When running
moon docker setupinside a Docker container that already has the exact Node.js version Moon is configured to use (e.g. using an officialnode:20base image), Moon still downloads and installs Node.js through proto. This is redundant — it slows down Docker builds and adds ~200 MB of bloat to the image since Node.js ends up installed twice.The current workaround is
MOON_TOOLCHAIN_FORCE_GLOBALS=node, but this is all-or-nothing — it unconditionally skips installation with no fallback. If the system binary is missing or the wrong version, commands will fail at runtime.Describe the solution you'd like
Before downloading/installing a toolchain, Moon should check if a matching version already exists on the system PATH. If the system binary satisfies the configured version requirement, skip the proto installation and use the system binary directly.
This could work as a new option, for example:
Or it could be an additional mode for
MOON_TOOLCHAIN_FORCE_GLOBALS, e.g.MOON_TOOLCHAIN_FORCE_GLOBALS=node:prefermeaning "use system if available and matching, otherwise install."Describe alternatives you've considered
MOON_TOOLCHAIN_FORCE_GLOBALS=node— works but has no fallback if the system binary is missing or wrong version. It also doesn't verify the version matches.moon docker setup— adds unnecessary complexity to the Dockerfile.Additional context
This is especially relevant for Docker workflows where base images already bundle the correct runtime. Avoiding a redundant download would improve build times and reduce image layer size.