All, I am trying to install PSReadLine to explore the “Predictive Intellisense ” . However, when I installed PSReadLine and enabled that feature…
below is the msg I got.
“Set-PSReadLineOption: A parameter cannot be found that matches parameter name ‘PredictionSource’ ”
with little google search I found this
opened 10:33PM - 06 Feb 21 UTC
closed 04:38PM - 07 Feb 21 UTC
<!--
Before submitting your bug report ...
- Please make sure you are able t… o reproduce the issue with the latest version of PSReadLine.
- Please check for duplicates. +1 the duplicate if you find one and add additional details if you have any.
The maintainer may close your issue without further explanation or engagement if:
- You delete this entire template and go your own path;
- You file an issue that has many duplicates;
- You file an issue completely blank in the body.
-->
## Environment
```none
PS version: 5.1.19041.610
PSReadline version: 2.2.0-beta1
os: 10.0.19041.1 (WinBuild.160101.0800)
PS file version: 10.0.19041.1 (WinBuild.160101.0800)
HostName: ConsoleHost
BufferWidth: 190
BufferHeight: 5000
```
<!--
The following script will generate the environment data that helps triage and investigate the issue.
Please run the script in the PowerShell session where you ran into the issue and provide the output above.
& {
$hostName = $Host.Name
if ($hostName -eq "ConsoleHost" -and (Get-Command Get-CimInstance -ErrorAction SilentlyContinue)) {
$id = $PID
$inWindowsTerminal = $false
while ($true) {
$p = Get-CimInstance -ClassName Win32_Process -Filter "ProcessId Like $id"
if (!$p -or !$p.Name) { break }
if ($p.Name -eq "WindowsTerminal.exe") { $inWindowsTerminal = $true; break }
$id = $p.ParentProcessId
}
if ($inWindowsTerminal) { $hostName += " (Windows Terminal)" }
}
"`nPS version: $($PSVersionTable.PSVersion)"
$m = Get-Module PSReadline
$v = $m.Version; $pre = $m.PrivateData.PSData.Prerelease
if ($pre) { $v = "$v-$pre" }
"PSReadline version: $v"
if ($IsLinux -or $IsMacOS) {
"os: $(uname -a)"
} else {
"os: $((dir $env:SystemRoot\System32\cmd.exe).VersionInfo.FileVersion)"
}
"PS file version: $($name = if ($PSVersionTable.PSEdition -eq "Core") { "pwsh.dll" } else { "powershell.exe" }; (dir $pshome\$name).VersionInfo.FileVersion)"
"HostName: $hostName"
"BufferWidth: $([console]::BufferWidth)"
"BufferHeight: $([console]::BufferHeight)`n"
}
-->
## Exception report
Set-PSReadLineOption : A parameter cannot be found that matches parameter name 'PredictionSource'.
## Steps to reproduce
In PowerShell 5.1 with PSReadline 2.2.0-beta1
Attempt to set 'PredictionSource' setting
## Expected behavior
PredictionSource aka predictive IntelliSense should be available in 2.2.0-beta1 with PowerShell 5.1.
## Actual behavior
Error message as described in title.
I feel, that I'm missing something obvious, but I can't get it to work. In PowerShell 7 on the same machine, it does work just fine.
when I tried to uninstall PSReadLine this is what I got.
that said, when I checked for any version of psreadline…I still see the bottom versions.
can some one please let me know how I can uninstall all the versions currently installed on machine and do a clean install. I even tried exiting the PowerShell session hoping that would solve the problem.
TIA.
You have version 2.0.0 of PSReadline and the PredictionSource parameter was introduced in 2.1.0.
Try upgrading PSReadline. Running PowerShell as an Administrator:
powershell -noprofile -command "Install-Module PSReadline -Force"
Two things you may need to do if you get an error or have problems updating it:
Set the TLS version:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Update PowerShellGet:
powershell -noprofile -command "Install-Module -Name PowerShellGet -Force -AllowClobber"
2 Likes
Thank you @matt-bloomfield for the reply.
I have couple of q’s -
#1 . how/where do I set the following:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
I have updated PowerShellGet and re-installed psreadline…I still get the same error.
#2 . If I have couple of different versions, does PowerShell use the latest version or do I have a choice of specifying the version to use?
pls let me know if I am doing anything wrong here. thank you!
Just run the command in a PowerShell prompt. You can add it to your profile if you want to make it permanent.
It should load the latest version when you restart PowerShell. If you want to load an earlier version, use Remove-Module
then Import-Module
using the -MaximumVersion
parameter.
Also, as a tip for future posts, please try to copy and paste your output and format it with the </> button rather than posting images.
2 Likes
Thank you @matt-bloomfield …it worked.
1 Like