Issue with NuGet in PowerShell 7.0.1 on Mac OS Catalina

Hello,

I recently installed PowerShell 7.0.1 using the package installer found in the Git repo (https://github.com/PowerShell/PowerShell). The install completed fine and with no errors but, I’m getting an error related to NuGet when I try to do things like installing a module. Here’s an example of what I’m referring to:

PS /Users/cartersheehan> Install-Module -Name AWSLambdaPSCore                                                                                                                                     

NuGet provider is required to continue

PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet provider must be available in '' or ''. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 

2.8.5.201 -Force'. Do you want PowerShellGet to install and import the NuGet provider now?

[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y

Install-PackageProvider: /usr/local/share/powershell/Modules/PowerShellGet/1.6.5/PSModule.psm1:3208

Line |

3208 |     $null = PackageManagement\Install-PackageProvider -Name $script:N

     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     | Unable to find repository with SourceLocation ''. Use Get-PSRepository to see all available repositories.

Import-PackageProvider: /usr/local/share/powershell/Modules/PowerShellGet/1.6.5/PSModule.psm1:3214

Line |

3214 |     $null = PackageManagement\Import-PackageProvider -Name $script:Nu

     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     | 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.

Get-PackageProvider: /usr/local/share/powershell/Modules/PowerShellGet/1.6.5/PSModule.psm1:3218

Line |

3218 |  … tProvider = PackageManagement\Get-PackageProvider -Name $script:NuGet

     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     | Unable to find package provider 'NuGet'. It may not be imported yet. Try 'Get-PackageProvider -ListAvailable'.

Install-Module: NuGet provider is required to interact with NuGet-based repositories. Please ensure that '2.8.5.201' or newer version of NuGet provider is installed.

PS /Users/cartersheehan> Get-PSRepository

Get-PackageSource: /usr/local/share/powershell/Modules/PowerShellGet/1.6.5/PSModule.psm1:9224

Line |

9224 |  … ckageSources = PackageManagement\Get-PackageSource @PSBoundParameters

     |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     | Unable to find module providers (PowerShellGet).

PS /Users/cartersheehan> Install-Module -Name PowerShellGet -Force

NuGet provider is required to continue

PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet provider must be available in '' or ''. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 

2.8.5.201 -Force'. Do you want PowerShellGet to install and import the NuGet provider now?

[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y

Install-PackageProvider: /usr/local/share/powershell/Modules/PowerShellGet/1.6.5/PSModule.psm1:3208

Line |

3208 |     $null = PackageManagement\Install-PackageProvider -Name $script:N

     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     | Unable to find repository with SourceLocation ''. Use Get-PSRepository to see all available repositories.

Import-PackageProvider: /usr/local/share/powershell/Modules/PowerShellGet/1.6.5/PSModule.psm1:3214

Line |

3214 |     $null = PackageManagement\Import-PackageProvider -Name $script:Nu

     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     | 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.

Get-PackageProvider: /usr/local/share/powershell/Modules/PowerShellGet/1.6.5/PSModule.psm1:3218

Line |

3218 |  … tProvider = PackageManagement\Get-PackageProvider -Name $script:NuGet

     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     | Unable to find package provider 'NuGet'. It may not be imported yet. Try 'Get-PackageProvider -ListAvailable'.

Install-Module: NuGet provider is required to interact with NuGet-based repositories. Please ensure that '2.8.5.201' or newer version of NuGet provider is installed.

PS /Users/cartersheehan> Install-PackageProvider -Name NuGet -RequiredVersion 2.8.5.201 -Force     

OperationStopped: Collection was modified; enumeration operation may not execute.

PS /Users/cartersheehan> 

As you can see, doing actions require NuGet but, when prompted to install NuGet or when I try to install it myself, it fails.

Any help will be greatly appreciated!

Thank you,

Carter

bump

Please don’t post just to “bump” - it typically gets you the reverse of what you want. I’m not sure if the TLS setting is only applicable to windows or not, but you may try this.

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 
Install-Module PowerShellGet -RequiredVersion 2.2.4 -SkipPublisherCheck

Doug,

My apologies. I tried your suggestion to adjust the tls security setting but I still get the same prompt to install NuGet before the install of PowerShellGet can even happen. During the NuGet install I get the same error messages.

Carter,

I’ll see if it’s consistent on my Mac. Have you tried any other version?

Doug,

I have not tested any other version right now, I went right for the LTS version available in the Git repo. I’ve swapped over to the Windows side of my Mac (bootcamp), so I’m able to get around this problem for now. I’ve installed the same version on the Windows side of my machine and did not run into the same issue.