Skip to content

Commit 7cf54bd

Browse files
committed
fix: find node binary correctly in externals directory
Search for the actual node executable file instead of directory names. The previous approach found directories like 'node24_alpine' that don't contain the binary, causing 'No such file or directory' errors. Now searches for executable files named 'node' which correctly finds the actual binary location.
1 parent 13ca241 commit 7cf54bd

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

cache_tools.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@ export RUNNER_TOOL_CACHE="$TOOL_CACHE"
1414
export AGENT_TOOLSDIRECTORY="$TOOL_CACHE"
1515

1616
# Find the Node.js runtime installed by the GitHub Actions runner
17-
NODE_DIR=$(find /actions-runner/externals -name "node*" -type d | head -1)
18-
if [ -z "$NODE_DIR" ]; then
19-
echo "⚠ Warning: Node.js not found in /actions-runner/externals/, skipping tool cache"
17+
# Look for the node binary itself, not just directories
18+
NODE_BIN=$(find /actions-runner/externals -name "node" -type f -executable 2>/dev/null | head -1)
19+
if [ -z "$NODE_BIN" ]; then
20+
echo "⚠ Warning: Node.js binary not found in /actions-runner/externals/, skipping tool cache"
2021
exit 0
2122
fi
2223

23-
NODE_BIN="$NODE_DIR/bin/node"
24-
NPM_BIN="$NODE_DIR/bin/npm"
24+
NODE_DIR=$(dirname "$NODE_BIN")
25+
NPM_BIN="$NODE_DIR/npm"
2526

26-
if [ ! -f "$NODE_BIN" ]; then
27-
echo "⚠ Warning: Node binary not found at $NODE_BIN, skipping tool cache"
27+
if [ ! -f "$NPM_BIN" ]; then
28+
echo "⚠ Warning: npm not found at $NPM_BIN, skipping tool cache"
2829
exit 0
2930
fi
3031

0 commit comments

Comments
 (0)