Skip to content

Commit 689f7cc

Browse files
committed
Handle non-semver node versions
sh-semver emits warnings when non-semver strings are passed to it. So we should filter out and ignore any node versions that don't at least start with a number. This could be a lot smarter, and currently only works because node versions omit the implicit 'node-' prefix.
1 parent 0661eda commit 689f7cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libexec/nodenv-package-json-engine

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ find_installed_version_matching_expression() {
4646
local -a installed_versions
4747
while IFS= read -r v; do
4848
installed_versions+=( "$v" )
49-
done < <(nodenv versions --bare --skip-aliases)
49+
done < <(nodenv versions --bare --skip-aliases | grep -e '^[[:digit:]]')
5050

5151
version=$("$SEMVER" -r "$version_expression" "${installed_versions[@]}" \
5252
| tail -n 1)

0 commit comments

Comments
 (0)