Saturday 7 August 2021

Powershell - a parameter cannot be found that matches parameter name 'AllowPrerelease'

Sometimes when installing powershell modules, you may wish to utilise pre-release or preview versions of packages. Depending on what version of powershell you have installed, you may get an error message like the one below when attempting to install preview/prerelease packages;

Install-Module : A parameter cannot be found that matches parameter name 'AllowPrerelease'.

At line:1 char:37

To fix the problem you need to force an update of a couple of Powershell modules - namely PowershellGet and PackageManagement. 

Run the commands below from an elevated powershell command prompt;

Install-Module -Name PowerShellGet -Repository PSGallery -Force
Install-Module -Name PackageManagement -Repository PSGallery -Force

Exit/close your Powershell window/session then re-open and run the install-module command again - it should now complete successfully

No comments:

Post a Comment