fix(install): reject PATH runtimes with broken npm (#107825)

* fix(install): reject runtimes with broken npm

* test(installer): use real Node for npm selection

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
ooiuuii
2026-07-17 08:17:07 +08:00
committed by GitHub
parent 382d570cbf
commit 396194b96b
2 changed files with 80 additions and 0 deletions
+5
View File
@@ -447,6 +447,7 @@ link_node_runtime_paths() {
}
linked_node_is_usable() {
local candidate_bin
local current_version
local required_version
@@ -462,6 +463,10 @@ linked_node_is_usable() {
if ! semver_at_least "$current_version" "$required_version"; then
return 1
fi
candidate_bin="$(node_dir)/bin"
if ! PATH="${candidate_bin}:${PATH}" "$(npm_bin)" --version >/dev/null 2>&1; then
return 1
fi
"$(node_bin)" -e '
const { DatabaseSync } = require("node:sqlite");