{"record":{"id":"07c7f337023b077e","repo":"oraios/serena","slug":"powershell-core-pwsh-is-not-installed-or-not-in","errorCode":null,"errorMessage":"PowerShell Core (pwsh) is not installed or not in PATH. Please install PowerShell 7+ from https://github.com/PowerShell/PowerShell","messagePattern":"PowerShell Core \\(pwsh\\) is not installed or not in PATH\\. Please install PowerShell 7\\+ from https://github\\.com/PowerShell/PowerShell","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"src/solidlsp/language_servers/powershell_language_server.py","lineNumber":174,"sourceCode":"            raise RuntimeError(f\"Failed to find Start-EditorServices.ps1 after extraction at {start_script}\")\n\n        log.info(f\"PowerShell Editor Services installed at: {install_dir}\")\n        return str(start_script)\n\n    @classmethod\n    def _setup_runtime_dependency(cls, solidlsp_settings: SolidLSPSettings) -> tuple[str, str, str]:\n        \"\"\"\n        Check if required PowerShell runtime dependencies are available.\n        Downloads PowerShell Editor Services if not present.\n\n        Returns:\n            tuple: (pwsh_path, start_script_path, bundled_modules_path)\n\n        \"\"\"\n        # Check for PowerShell Core\n        pwsh_path = cls._get_pwsh_path()\n        if not pwsh_path:\n            raise RuntimeError(\n                \"PowerShell Core (pwsh) is not installed or not in PATH. \"\n                \"Please install PowerShell 7+ from https://github.com/PowerShell/PowerShell\"\n            )\n\n        # Check for PowerShell Editor Services\n        pses_path = cls._get_pses_path(solidlsp_settings)\n        if not pses_path:\n            log.info(\"PowerShell Editor Services not found. Downloading...\")\n            pses_path = cls._download_pses(solidlsp_settings)\n\n        # The bundled modules path is the directory containing PowerShellEditorServices\n        bundled_modules_path = str(Path(pses_path).parent)\n        psscriptanalyzer_version = solidlsp_settings.get_ls_specific_settings(LanguageServerId.POWERSHELL).get(\n            \"psscriptanalyzer_version\", PSSCRIPTANALYZER_VERSION\n        )\n        psscriptanalyzer_path = Path(bundled_modules_path) / \"PSScriptAnalyzer\" / psscriptanalyzer_version\n        if not psscriptanalyzer_path.exists():\n            log.info(f\"PSScriptAnalyzer {psscriptanalyzer_version} not found. Installing...\")","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/powershell_language_server.py#L156-L192","documentation":"The PowerShell language server runs on PowerShell Editor Services, which requires PowerShell 7+ (pwsh) as the host runtime. _setup_runtime_dependency first resolves pwsh via _get_pwsh_path (PATH lookup plus a few well-known install locations); if nothing is found, it raises this RuntimeError during __init__. The library deliberately does not download pwsh itself.","triggerScenarios":"Constructing the PowerShell language server (SolidLanguageServer.create for 'powershell') on a machine where pwsh is neither on PATH nor at the hardcoded locations (/usr/bin/pwsh, /usr/local/bin/pwsh, /opt/homebrew/bin/pwsh, /opt/microsoft/powershell/7/pwsh, ~/.dotnet/tools/pwsh, or the Windows Program Files path) — i.e. only Windows PowerShell 5.1 (powershell.exe) is installed, or pwsh was installed via snap/other package managers that don't add these paths.","commonSituations":"Fresh Linux/macOS/CI containers without PowerShell; having only built-in Windows PowerShell 5.1; installing pwsh via a method that doesn't update PATH; a venv/docker image where PATH was modified after install.","solutions":["Install PowerShell 7+ from https://github.com/PowerShell/PowerShell for your OS.","Ensure the pwsh binary's directory is on your PATH (echo $env:PATH / echo $PATH) or symlink it, e.g. ln -s /opt/microsoft/powershell/7/pwsh /usr/local/bin/pwsh.","On Windows, install the MSI (adds pwsh to PATH) rather than relying on Windows PowerShell 5.1.","In CI, use a setup step (e.g. PowerShell action or winget/apt/brew install powershell) before creating the server."],"exampleFix":"# before: only powershell.exe (5.1) present on Windows PATH\n# after: install PowerShell 7 and verify\nwinget install --id Microsoft.PowerShell\npwsh -v   # or: Get-Command pwsh","handlingStrategy":"validation","validationCode":"import shutil\nif shutil.which('pwsh') is None:\n    raise SystemExit(\n        'PowerShell 7+ (pwsh) is required. Install from '\n        'https://github.com/PowerShell/PowerShell and ensure it is on PATH.'\n    )","typeGuard":null,"tryCatchPattern":"try:\n    server = SolidLanguageServer.create('powershell', repo_root, settings)\nexcept RuntimeError as e:\n    if 'PowerShell Core (pwsh) is not installed' in str(e):\n        raise EnvironmentError(\n            'Install PowerShell 7+ first: https://github.com/PowerShell/PowerShell'\n        ) from e\n    raise","preventionTips":["Run `pwsh -v` (or `Get-Command pwsh`) in the same shell/environment that runs Serena before enabling the PowerShell language.","In CI/Docker, add an explicit pwsh install step to the image.","Remember Windows PowerShell 5.1 (powershell.exe) is NOT sufficient — pwsh must be PowerShell 7+.","If pwsh is installed off-PATH, symlink it to /usr/local/bin/pwsh or extend PATH."],"tags":["powershell","missing-dependency","environment-setup","language-server"],"backgroundTag":"missing-required-binary","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}