Unable to find package providers (NuGet)

In this azure tutorial, we will discuss how to fix the error, Unable to find package providers (NuGet), and No match was found for the specified search criteria and provider name ‘NuGet’. Try ‘Get-PackageProvider -ListAvailable’ to see if the provider exists on the system which comes while trying to install the PowerShell Nuget and Azure PowerShell module using PowerShell ISE.

Unable to find package providers (NuGet)

Recently, while I was trying to install PowerShell Nuget, I got this error “Unable to find package providers (NuGet)“. I was executing the PowerShell script to install PowerShell Nuget and I got this error

When I was trying to install the ‘Nuget’ package using the below PowerShell cmdlet, I got the above error

I was executing the below line of code to install Nuget PowerShell.

$_nugetUrl = "https://api.nuget.org/v3/index.json" 
$MypS = Get-PackageSource
if(@($MypS).Where{$_.location -eq $_nugetUrl}.count -eq 0)
{
   Register-PackageSource -Name MyNuGet -Location $_nugetUrl -ProviderName NuGet
}

I got the below error “Unable to find package providers (NuGet)“, see below Powershell not able to access “NuGet” package

Unable to find package providers (NuGet)

Why are we exactly getting this error Unable to install NuGet provider for PowerShell and what is the solution for Unable to find package providers (NuGet)?

Find the PowerShell version

You should always use the updated version of PowerShell. You need to run the below PwerShell cmdlet to check the PowerShell version on your system.

PS C:\WINDOWS\system32> Get-Host | Select-Object Version
Unable to install NuGet provider for PowerShell

Check the Transport Layer Security protocols

Let’s check the Transport layer security protocols on the system

PS C:\WINDOWS\system32> [Net.ServicePointManager]::SecurityProtocol

Once, you will run the above PowerShell cmdlet, you can see the version of Transport layer security protocols available on your system. If the versions are old and deprecated one then you need to enable at least TLS 1.2 or above.

Unable to find package providers (NuGet) [Solved]

Install-PackageProvider

To fix ,Unable to install NuGet provider for PowerShell, we need to follow the below steps to fix Unable to install NuGet provider for PowerShell

Step- 1:

Open PowerShell as run as Administrator

Step- 2:

Run the below command to enable TLS 1.2

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Step- 3:

Run the below command

Install-PackageProvider -Name NuGet

See the output here

Unable to find package providers (NuGet) how to fix

This is how we can fix the error Unable to find package providers (NuGet) and this is How do I install the Nuget Provider for PowerShell.

No match was found for the specified search criteria and provider name ‘NuGet’. Try ‘Get-PackageProvider -ListAvailable’ to see if the provider exists on the system.

Recently, while I was trying to install the Azure Powershell module I got this error. I was executing the below line of code and I got the above error

if (Get-Module -Name AzureRM -ListAvailable) {
    Write-Warning -Message 'Azure module not installed.'
} else {
    Install-Module -Name Az -AllowClobber -Scope AllUsers
}

Ohh, again I am getting the same error

No match was found for the specified search criteria and provider name 'NuGet'. Try 'Get-PackageProvider -ListAvailable' to see if the provider exists on the system

Now to fix this we need to follow the below steps

Step-1:

To fix this error, First, we need to install the ‘Nuget’ package by following the above steps.

Step- 2:

Then run the below command which will De-register and register the repository again.

Register-PSRepository -Default
How to fix Unable to find package providers (NuGet)

Step- 3:

Now run the below line of code to install the Azure PowerShell module. Now you will not get any error this time. This will install the Azure PowerShell module successfully.

if (Get-Module -Name AzureRM -ListAvailable) {
    Write-Warning -Message 'Azure module not installed.'
} else {
    Install-Module -Name Az -AllowClobber -Scope AllUsers
}

See below

How to install Azure PowerShell module

Step- 4:

Now you can see below it started installing the Azure PowerShell module.

Azure PowerShell module installed sucessfully

You may like following Azure tutorials:

Conclusion

In this article, we learned to fix the error “Unable to find package providers (NuGet)“. The solution to this issue is configuring TLS1.2 on the system. After that, you can install NuGet for PowerShell without any issue. I hope this Azure tutorial, helps you to fix the error Unable to find package providers (NuGet).

We also discussed the solution for the issue No match was found for the specified search criteria and provider name ‘NuGet’. Try ‘Get-PackageProvider -ListAvailable’ to see if the provider exists on the system which I got while trying to install the Azure PowerShell module.

Leave a Comment