On a host with no system Node, tools/install.sh bootstraps one into ~/.mosaic/node/current/bin and records it in ~/.profile. The fleet unit runs `env -i ... bash --noprofile --norc`, so ~/.profile is never read — that is deliberate — and _build_runtime_bin_prefix did not name the directory itself. Runtime binaries are `#!/usr/bin/env node`, so the pane resolved `mosaic` and then died on `env: 'node': No such file or directory` after an install that reported success. Measured on a greenfield VM. The existing `npm config get prefix` branch cannot cover it: that reports a package prefix (~/.npm-global), never a Node runtime directory. The test case asserts the property rather than the string — it runs the pane for real with a Node-shebang `mosaic` and requires the pane to have executed. A PATH substring check would pass on a fix that put the directory in the wrong position. Red without the launcher change, green with it, rest of the suite unaffected.
This commit is contained in:
@@ -268,6 +268,15 @@ esac
|
||||
_build_runtime_bin_prefix() {
|
||||
local candidates=()
|
||||
if [ -n "$MOSAIC_RUNTIME_BIN" ]; then candidates+=("$MOSAIC_RUNTIME_BIN"); fi
|
||||
# A host with no system Node gets one bootstrapped here by tools/install.sh, which
|
||||
# records it in ~/.profile. The fleet unit runs `env -i ... bash --noprofile --norc`
|
||||
# by design, so ~/.profile is never read and the directory has to be named here.
|
||||
# The npm probe below cannot cover this: it reports a package prefix
|
||||
# (~/.npm-global), never a Node runtime directory. It is first so the bootstrapped
|
||||
# runtime wins on a host that has both — that is the one the installer verified.
|
||||
# Runtime binaries are `#!/usr/bin/env node`, so without this the pane resolves the
|
||||
# binary and then dies on `env: 'node': No such file or directory`.
|
||||
candidates+=("$PANE_HOME/.mosaic/node/current/bin")
|
||||
if command -v npm >/dev/null 2>&1; then
|
||||
local npm_prefix
|
||||
npm_prefix=$(npm config get prefix 2>/dev/null) || true
|
||||
|
||||
Reference in New Issue
Block a user