-
Type:
Improvement
-
Resolution: Fixed
-
Priority:
Unknown
-
None
-
Component/s: Evergreen Tools
-
None
-
Not Needed
A specific npm version is tested and bundled with each Node.js release. Upgrading npm to @latest fails under certain conditions (e.g. npm@latest dropping support for an older Node major), so as a workaround we keep a compatibility matrix in install-node.sh:
# Pin npm per Node release to the newest npm that still supports it, so setup # never pulls an incompatible npm@latest. Do not override if it is already set. if [[ "$NODE_LTS_VERSION" =~ ^[0-9]+$ && "$NODE_LTS_VERSION" -lt 18 ]]; then NPM_VERSION=${NPM_VERSION:-9} elif [[ "$NODE_LTS_VERSION" =~ ^[0-9]+$ && "$NODE_LTS_VERSION" -lt 20 ]]; then NPM_VERSION=${NPM_VERSION:-10} elif [[ "$NODE_LTS_VERSION" =~ ^[0-9]+$ && "$NODE_LTS_VERSION" -lt 22 ]]; then NPM_VERSION=${NPM_VERSION:-11} else NPM_VERSION=${NPM_VERSION:-latest} fi export NPM_VERSION=${NPM_VERSION}
This only works when the Node.js version is passed as a bare major (e.g. 22). It fails when the version is a full string (e.g. 20.19.0), because the ^[0-9]+$ guard doesn't match. The Node driver hit exactly this: it pins NODE_LTS_VERSION=20.19.0, so the task tries to install npm@latest on Node 20 and failed.
Proposed fix: add a SKIP_NPM_UPGRADE flag so consumers who prefer the Node-bundled npm can opt out of the upgrade entirely.
- is related to
-
DRIVERS-3565 install-node.sh installs incompatible npm@latest (npm 12) on Node 20
-
- Closed
-