以下の内容はhttps://tsubalog.hatenablog.com/entry/2025/06/14/152627より取得しました。


PSReadLineをアップデートする方法

AI Shell をインストールしていて Start-AIShell コマンドを実行したら、このようなエラーが起きました。

Start-AIShell: The 'Start-AIShell' command was found in the module 'AIShell', but the module could not be loaded due to the following error: [The PSReadLine v2.4.2-beta2 or higher is required for the AIShell module to work properly.]
For more information, run 'Import-Module AIShell'.

AIShell モジュールがインポートされていないと思い、Import-Module AIShell コマンドを実行したら PSReadLine が古いらしい。

Exception: The PSReadLine v2.4.2-beta2 or higher is required for the AIShell module to work properly.

では PSReadLine のバージョンを確認してみます。

Get-Module -Name PSReadLine -ListAvailable

    Directory: C:\program files\powershell\7\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     2.3.6                 PSReadLine                          Desk      {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLin…

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     2.0.0                 PSReadLine                          Desk      {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLin

AIShell に要求されている 2.4.2-beta2 以上のバージョンが無いみたいなので、PSReadLine リポジトリに書いてある手順でアップデートしました。

github.com

Install-Module PSReadLine -Repository PSGallery -Scope CurrentUser -AllowPrerelease -Force

Get-Module -Name PSReadLine -ListAvailable

    Directory: D:\OneDrive - ymat\ドキュメント\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     2.4.2      beta2      PSReadLine                          Desk      {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLin…

    Directory: C:\program files\powershell\7\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     2.3.6                 PSReadLine                          Desk      {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLin…

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     2.0.0                 PSReadLine                          Desk      {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLin

これで Start-AIShell コマンドも動くようになりました。




以上の内容はhttps://tsubalog.hatenablog.com/entry/2025/06/14/152627より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14