|
| 1 | +--- |
| 2 | +title: Desktop Node Environment |
| 3 | +description: Explains why HagiCode Desktop bundles Node.js and how it prefers bundled Node paths while the user runs Desktop. |
| 4 | +sidebar: |
| 5 | + order: 20 |
| 6 | +--- |
| 7 | + |
| 8 | +HagiCode Desktop ships with a Desktop-managed Node toolchain. It does not take over the global Node installation on your computer. Its purpose is to give Desktop startup and runtime-related flows a stable and verifiable runtime foundation. |
| 9 | + |
| 10 | +Read this FAQ if you see `portable-fixed/toolchain` in diagnostics, need to know which `node` Desktop is using, or wonder why your system Node version does not directly define Desktop runtime behavior. |
| 11 | + |
| 12 | +## Why Desktop bundles Node |
| 13 | + |
| 14 | +Desktop needs to run the same supporting flows across operating systems, installation channels, and user environments. If it depended only on the user's existing Node installation, support would have to handle outdated versions, missing npm, incorrect path ordering, polluted global packages, and organization-specific registry policies all at once. |
| 15 | + |
| 16 | +Desktop describes this more specifically as an isolated Node/npm runtime for managed CLIs instead of reusing the system-wide environment. This design has these main benefits: |
| 17 | + |
| 18 | +- **Consistent versions**: Desktop uses a pinned Node 22 runtime contract instead of guessing the user's local major version. |
| 19 | +- **Controlled startup flows**: Desktop-managed commands can prefer the packaged `node` and `npm` entries. |
| 20 | +- **Clear configuration boundaries**: CLI-related configuration is kept separate from host-wide global configuration, so updates, switching, and recovery are less likely to be disrupted by system environment differences. |
| 21 | +- **Reduced conflicts**: Bundled paths apply to command environments created by Desktop and do not replace the user's global Node in their terminal. |
| 22 | +- **Non-intrusive host behavior**: This isolation avoids writing toolchain state into the user's existing Node/npm environment, and uninstalling Desktop does not disturb the Node, npm, or configuration already present on the machine. |
| 23 | + |
| 24 | +## How Desktop selects the Node path |
| 25 | + |
| 26 | +When you run Desktop normally, Desktop prefers the Node toolchain installed with the app instead of first reading the Node installation from your system. This keeps the Node version in your terminal separate from the Node version Desktop expects while it runs. |
| 27 | + |
| 28 | +When the bundled toolchain is enabled, command environments created by Desktop put bundled toolchain paths at the front of `PATH`. As a result, even if your system has another Node version installed, Desktop-managed flows resolve to Desktop's bundled Node and npm first. |
| 29 | + |
| 30 | +This only affects runtime environments created by Desktop. If you run `node`, `npm`, or other commands directly in your system terminal, they continue to use your normal system environment and shell configuration. |
| 31 | + |
| 32 | +In diagnostics or child-process environments started by Desktop, you may see a variable like this: |
| 33 | + |
| 34 | +```bash |
| 35 | +HAGICODE_PORTABLE_TOOLCHAIN_ROOT=/path/to/portable-fixed/toolchain |
| 36 | +``` |
| 37 | + |
| 38 | +This variable means the Desktop-managed runtime environment recognized the bundled toolchain root. Seeing this path does not mean Desktop changed your system Node; it only means Desktop is using the Node environment shipped with the app inside its own runtime scope. |
0 commit comments