[Android] buildsystem: Attempt auto-switching to Node 22 when building main branch

Nicolas Pomepuy git at videolan.org
Tue Nov 3 10:49:50 UTC 2026


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Oct 30 13:03:13 2026 +0100| [cb5b363b90707f1ab2e02bc7e5e9b5b9160496c9] | committer: Nicolas Pomepuy

buildsystem: Attempt auto-switching to Node 22 when building main branch

- Attempt to activate Node 22 via NVM, fnm, n, or asdf when building main branch\n- Only display an error and fail if Node 22 remains inactive after the attempt

> https://code.videolan.org/videolan/vlc-android/commit/cb5b363b90707f1ab2e02bc7e5e9b5b9160496c9
---

 buildsystem/compile-remoteaccess.sh | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/buildsystem/compile-remoteaccess.sh b/buildsystem/compile-remoteaccess.sh
index 47763d4071..91ebd3c998 100755
--- a/buildsystem/compile-remoteaccess.sh
+++ b/buildsystem/compile-remoteaccess.sh
@@ -115,9 +115,34 @@ if [ "$INIT_ONLY" != 1 ]; then
     cd "$VLC_REMOTE_ACCESS_PATH"
 
     if [ "$USE_MAIN" = 1 ]; then
+        # Check current Node.js major version
         NODE_VERSION=$(node -v 2>/dev/null | sed -E 's/^v([0-9]+).*/\1/')
+
+        # If Node 22 is not active, attempt to switch automatically using standard version managers
         if [ "$NODE_VERSION" != "22" ]; then
-            fail "Node 22 is required to build the remote access main branch (found Node v${NODE_VERSION:-unknown})."
+            # Attempt to activate Node 22 using NVM if available
+            if [ -s "${NVM_DIR:-$HOME/.nvm}/nvm.sh" ]; then
+                . "${NVM_DIR:-$HOME/.nvm}/nvm.sh" 2>/dev/null || true
+                nvm use 22 >/dev/null 2>&1 || true
+            # Attempt to activate Node 22 using fnm if available
+            elif command -v fnm >/dev/null 2>&1; then
+                eval "$(fnm env 2>/dev/null)" || true
+                fnm use 22 >/dev/null 2>&1 || true
+            # Attempt to activate Node 22 using n if available
+            elif command -v n >/dev/null 2>&1; then
+                n 22 >/dev/null 2>&1 || true
+            # Attempt to activate Node 22 using asdf if available
+            elif command -v asdf >/dev/null 2>&1; then
+                asdf shell nodejs 22 >/dev/null 2>&1 || true
+            fi
+
+            # Re-check Node.js major version
+            NODE_VERSION=$(node -v 2>/dev/null | sed -E 's/^v([0-9]+).*/\1/')
+
+            # Only display an error message and fail if Node 22 is still not available
+            if [ "$NODE_VERSION" != "22" ]; then
+                fail "Node 22 is required to build the remote access main branch (found Node v${NODE_VERSION:-unknown}). Please install or switch to Node 22."
+            fi
         fi
     fi
 



More information about the Android mailing list