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
}

Unable to install NuGet provider Issue With PowerShell

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)
unable to find package provider ‘nuget’

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

The first step is that we need to verify the version of the Transport Layer Security protocols using the below PowerShell cmdlet

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 very much older and even already deprecated for long then you need to enable the latest version of the Transport layer security protocol.

Unable to find package providers (NuGet) [Solved]

Install-PackageProvider

To fix, Unable to install NuGet provider error in PowerShell, we need to follow the below steps to fix the Unable to install NuGet provider issue

Step- 1:

Open PowerShell as run as Administrator

Step- 2:

Run the below command to enable TLS 1.2 or you can also enable TLS 1.3 or even any higher versions

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

or



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

Step- 3:

Run the below command

Install-PackageProvider -Name NuGet

See the output here

Unable to find package providers (NuGet) how to fix
nuget provider

This is how we can fix the error Unable to find package providers (NuGet) or Unable to find package provider ‘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
unable to find package provider nuget

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)
register-packagesource : 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

unable to find package provider 'nuget'.
unable to find package provider ‘nuget’.

Step- 4:

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

unable to find package providers
unable to find package providers

No match was found for the specified search criteria and provider name ‘NuGet’ – Video Tutorial

You may like the following Azure tutorials:

Conclusion

In this article, we learned to fix the error “Unable to find package providers (NuGet)“. Now, 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). The same solution will also fix the below errors

  • unable to find package provider ‘NuGet’ PowerShell
  • get-packageprovider : unable to find package provider ‘NuGet’
  • install PowerShell NuGet provider
  • Install-PackageProvider
  • PowerShell install NuGet provider
  • Powershell not able to access packages / “NuGet” package provider
  • Powershell not able to access packages / “NuGet” package provider after security configuration update
  • How do I install the Nuget provider for PowerShell

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.