Files
compiler-explorer/etc/scripts/find-node
Matt Godbolt 7785165903 Bump Node floor to v22 (#8764)
Raises Compiler Explorer's minimum Node version from 20 to 22, aligning
the declared floor with what production actually runs (Node 22.13.1
across the fleet).

## Why
- Production already runs Node 22.13.1 everywhere; the declared floor
(`>=20`) lagged reality.
- It's a prerequisite for upcoming dependency majors — commander 15
requires Node >=22.12.

## Changes
- `package.json`: `engines.node` `>=20.0.0` → `>=22.0.0`.
- `etc/scripts/find-node`: `NODE_MIN_VERSION` `20` → `22`.
- `.github/workflows/test-and-deploy.yml`: the `build_minimum_support`
job moves from Node 20.18.2 to 22.12.0 (the genuine floor), since
`find-node` now rejects Node <22.

Split out from the major-dependency PR (#8761) so it can land
independently. #8761 will rebase cleanly on top once this merges.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 17:43:16 -05:00

47 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
set -e
OUT="$1"
find_node() {
NODE="${NODE_DIR}/bin/node"
CE_NODE="/opt/compiler-explorer/node/bin/node"
SYS_NODE="$(command -v node 2>/dev/null || true)"
SYS_NODEJS="$(command -v nodejs 2>/dev/null || true)"
if test -x "${NODE}" -a -n "${NODE_DIR}"; then
echo "${NODE}"
elif test -x "${CE_NODE}"; then
echo "${CE_NODE}"
elif test -x "${SYS_NODE}"; then
echo "${SYS_NODE}"
elif test -x "${SYS_NODEJS}"; then
echo "${SYS_NODEJS}"
else
echo >&2 "Unable to find a node"
fi
}
NODE="$(find_node)"
NODE_MIN_VERSION=22
NODE_VERSION_USED=22
NODE_VERSION=$(${NODE} --version)
NODE_MAJOR_VERSION=$(echo "${NODE_VERSION}" | cut -f1 -d. | sed 's/^v//g')
if test "${NODE_MAJOR_VERSION}" -lt ${NODE_MIN_VERSION}; then
echo >&2 "Compiler Explorer is known not to run with versions prior to v${NODE_MIN_VERSION}"
echo >&2 "Visit https://nodejs.org/ for installation instructions for newer versions"
echo >&2 "To configure where we look for node, set NODE_DIR to its installation base"
exit 1
fi
if test ${NODE_VERSION_USED} -ne "${NODE_MAJOR_VERSION}"; then
echo >&2 "Warning: Compiler Explorer is only tested against v${NODE_VERSION_USED}.x, but v${NODE_MAJOR_VERSION} was found."
echo >&2 "Note that you might find issues if you decide to keep this version"
echo >&2 "Visit https://nodejs.org/ for installation instructions for the required version"
echo >&2 "To configure where we look for node, set NODE_DIR to its installation base"
fi
echo "${NODE}" >"${OUT}"