oraios/serena · error · RuntimeError

Node.js is not installed or isn't in PATH. Please install No

Error message

Node.js is not installed or isn't in PATH. Please install Node.js and try again.

What it means

The MATLAB language server is a Node.js script, so create_launch_command first resolves `node` via shutil.which. If Node.js is not on PATH, the server cannot be launched at all and RuntimeError is raised with install guidance.

Source

Thrown at src/solidlsp/language_servers/matlab_language_server.py:332

            matlab_path = self._custom_settings.get("matlab_path")

            if not matlab_path:
                matlab_path = self._find_matlab_installation()  # Raises RuntimeError if not found

            # Verify MATLAB path exists
            if not os.path.isdir(matlab_path):
                raise RuntimeError(f"MATLAB installation directory does not exist: {matlab_path}")

            log.info(f"Using MATLAB installation: {matlab_path}")

            self._matlab_path = matlab_path
            return matlab_path

        def create_launch_command(self) -> list[str]:
            # Verify node is installed
            node_path = shutil.which("node")
            if node_path is None:
                raise RuntimeError("Node.js is not installed or isn't in PATH. Please install Node.js and try again.")

            # Find existing extension or download if needed
            extension_path = self._find_matlab_extension()
            if extension_path is None:
                log.info("MATLAB extension not found on disk, attempting to download...")
                extension_path = self._download_and_install_matlab_extension()

            if extension_path is None:
                raise RuntimeError(
                    "Failed to locate or download MATLAB Language Server. Please either:\n"
                    "1. Set MATLAB_EXTENSION_PATH environment variable to the MATLAB extension directory\n"
                    "2. Install the MATLAB extension in VS Code (MathWorks.language-matlab)\n"
                    "3. Ensure internet connection for automatic download"
                )

            # Get the language server script path
            server_script = self._get_executable_path(extension_path)

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Install Node.js (apt install nodejs, brew install node, or the official installer)
  2. Ensure the node binary's directory is on PATH for the process running the library (e.g. source nvm in the launch script, or set PATH in the service unit/Dockerfile)
  3. Verify with `which node` / shutil.which("node") in the same environment that runs the server

Example fix

# before (service file)
ExecStart=/opt/myapp/server
# after
Environment="PATH=/usr/local/bin:/usr/bin:%p/bin"
ExecStart=/opt/myapp/server   # node now resolvable
Defensive patterns

Strategy: validation

Validate before calling

import shutil
if shutil.which("node") is None:
    raise RuntimeError("Node.js must be installed and on PATH before starting the MATLAB language server")

Type guard

def node_available() -> bool:
    return shutil.which("node") is not None

Try / catch

try:
    ls = SolidLSP("matlab")
except RuntimeError as e:
    if "Node.js is not installed" in str(e):
        ensure_node_on_path()  # install node / extend PATH
        ls = SolidLSP("matlab")
    else:
        raise

Prevention

When it happens

Trigger: create_launch_command is called (during MATLAB language server startup) on a machine where `node` is not installed or is not on the PATH of the process running the library — common in systemd services, Docker containers, or IDE-spawned processes with a stripped PATH.

Common situations: Fresh CI runners without Node; nvm-managed Node not loaded in non-interactive shells; running inside Docker with a slim base image; launching from a GUI app whose PATH differs from your shell.

Related errors


AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29). Data as JSON: /api/errors/7f498c7880ed2283. Report an issue: GitHub.