Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,52 @@ The local-binary path does not authenticate the file for you. Verify its origin
and digest before installing it. The shell installer may still resolve the
latest release if no `--version` is supplied, even with `--binary`.

### Windows PowerShell 5.1: 'Get-FileHash' is not recognized

`install.ps1` runs under PowerShell 7 (`pwsh`) and under Windows PowerShell 5.1
(`powershell`). Typing `powershell` at a PowerShell 7 prompt is fine: PowerShell
7 removes its own module paths from `PSModulePath` for a Windows PowerShell it
starts directly. A Windows PowerShell started through another program that
PowerShell 7 launched, such as `cmd.exe`, Python, a build tool or an editor
task, inherits PowerShell 7's `PSModulePath` unchanged. It then finds PowerShell
7's copies of built-in modules first, cannot load them, and cannot auto-load some
commands, including `Get-FileHash`. See
[about_PSModulePath](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_psmodulepath).

The installer then fails at the checksum step with output such as:

```
Download failed: The term 'Get-FileHash' is not recognized as the name of a cmdlet, ...
Check that release v<version> exists for windows-x86_64:
https://github.com/OpenCoven/coven-code/releases/tag/v<version>
```

The release exists; the shell is the problem. The installer stops before it
extracts the archive: no executable is installed, an existing install is left
as it was, and the user PATH is not changed (the install directory may be left
behind, empty). Run it in one of these ways instead:

- Run it under PowerShell 7: `pwsh -NoProfile -File .\install.ps1`.
- Start Windows PowerShell 5.1 from the Start menu, or from a Command Prompt
that was not started from PowerShell 7, directly or through another program,
and run it there.
- Clear the variable for the Windows PowerShell you start, so it builds its own
module path. This works from a Command Prompt or PowerShell, run in the folder
that holds `install.ps1` (not a `\\server\share` path):

```
cmd /c "set PSModulePath=&& powershell -NoProfile -File .\install.ps1"
```

Pass the installer's parameters after `.\install.ps1`. If running scripts is
disabled, and you have inspected the script, put `-ExecutionPolicy Bypass`
before `-File` (for example `pwsh -NoProfile -ExecutionPolicy Bypass -File
.\install.ps1`); at an interactive prompt, run
`Set-ExecutionPolicy -Scope Process Bypass` first. Installs with `-Binary` do
not use `Get-FileHash` and are not affected, but check that binary's digest in
a shell that can load `Get-FileHash`, such as PowerShell 7, or with
`certutil -hashfile <file> SHA256`.

### Archive verification

For releases with `SHA256SUMS`, obtain the archive and manifest from the same
Expand Down