Unable to install NuGet package provider on PowerShell Core 7.0.3

Viewed 1710

I have a PowerShell Core 7.0.3 on Ubuntu 18.04.

When trying to install NuGet with the following command, it gives the error:

PS /home/adp/Downloads> Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-PackageProvider: Unable to find repository with SourceLocation ''. Use Get-PSRepository to see all available repositories.

The Get-PSRepository command also not working:

PS /home/adp/Downloads> Get-PSRepository 
Get-PackageSource: /home/adp/.local/share/powershell/Modules/PowerShellGet/2.1.2/PSModule.psm1:9186
Line |
9186 |  … ckageSources = PackageManagement\Get-PackageSource @PSBoundParameters
     |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Unable to find module providers (PowerShellGet).

And, Get-PackageProvider -ListAvailable returns nothing.

I also tried this solution, and it didn't work.

I'm stuck on the problem, any help is appreciated.

1 Answers

Deleting the Modules folder under \Documents\WindowsPowershell\ worked for us (source).

Related