nodejs/node · error · RuntimeError

Unable to locate armasm64.exe

Error message

Unable to locate armasm64.exe

What it means

On Windows ARM64, libffi assembly must be assembled with Microsoft's armasm64.exe because the .S files use ARM syntax clang-cl can't fully assemble. find_armasm64() checks PATH then VCINSTALLDIR\bin\Hostx64\arm64 and Hostarm64\arm64; if none of those exist it raises RuntimeError, so the script fails before producing a broken object.

Source

Thrown at deps/libffi/preprocess_asm.py:53

def find_armasm64():
    """Find armasm64.exe in the PATH or common Visual Studio locations."""
    # First check PATH
    path = shutil.which('armasm64.exe')
    if path:
        return path

    # Check common VS locations via environment
    vc_install_dir = os.environ.get('VCINSTALLDIR', '')
    if vc_install_dir:
        candidate = os.path.join(vc_install_dir, 'bin', 'Hostx64', 'arm64', 'armasm64.exe')
        if os.path.exists(candidate):
            return candidate
        candidate = os.path.join(vc_install_dir, 'bin', 'Hostarm64', 'arm64', 'armasm64.exe')
        if os.path.exists(candidate):
            return candidate

    raise RuntimeError('Unable to locate armasm64.exe')


def normalize_path(value):
    return str(value).strip().strip('"')


def unique_paths(paths):
    seen = set()
    result = []
    for path in paths:
        if path in seen:
            continue
        seen.add(path)
        result.append(path)
    return result


def preprocess(args):

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Install the MSVC ARM64 build tools (VS Installer > Individual components > MSVC v143 - VS 2022 C++ ARM64 build tools).
  2. Open the build from a Developer Command Prompt so PATH and VCINSTALLDIR are populated.
  3. Drop --assemble if you only need the preprocessed text and will assemble elsewhere.

Example fix

# before: arm64 toolchain missing
python preprocess_asm.py --input sysv.S --output out.s --assemble out.obj
# after: install MSVC ARM64 tools, then
python preprocess_asm.py --input sysv.S --output out.s --assemble out.obj
Defensive patterns

Strategy: validation

Validate before calling

import os, shutil
from pathlib import Path
def have_armasm64():
    if shutil.which('armasm64.exe'): return True
    vc = os.environ.get('VCINSTALLDIR','')
    return bool(vc) and (Path(vc)/'bin'/'Hostx64'/'arm64'/'armasm64.exe').exists()
assert have_armasm64(), 'install MSVC ARM64 build tools or run from a Developer Command Prompt'

Try / catch

try:
    armasm = find_armasm64()
except RuntimeError:
    raise SystemExit('ARM64 assembly needs armasm64.exe from the MSVC ARM64 workload')

Prevention

When it happens

Trigger: Raised by find_armasm64() when args.assemble is set, shutil.which('armasm64.exe') returns None, and no armasm64.exe exists under the VCINSTALLDIR candidates. Only reached on the ARM64-Windows assembly path.

Common situations: Building for ARM64 Windows without the 'Desktop development with C++' > ARM64 build tools component installed; CI image with only the x64 toolchain; VCINSTALLDIR set but pointing at a VS install that lacks the ARM64 workload.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/a864727583a2a632. Report an issue: GitHub.