Skip to content

General Troubleshooting

alerickson edited this page Oct 15, 2018 · 6 revisions

Why continuous prompts for installing NuGet provider?

Problem: I am running Win10 client, November update. Every time I run any of the PSGet cmdlets, I get prompted to install the latest Nuget provider. Why?

Yes known issue. Will be fixed in TP5.

Cause: the old version of the nuget exists under the providerassemblies root folder. It gets imported to your current PowerShell session

Current workaround: Delete the old version from $env:ProgramFiles\PackageManagement\ProviderAssemblies $env:LOCALAPPDATA\PackageManagement\ProviderAssemblies

Or Import-packageprovider –name nuget –requiredVersion 2.8.5.201 –force to your current session

Why is my PowerShell provider not listed from Get-PackageProvider?

Try the following:

  1. Get-PackageProvider -ListAvailable

This will show you the list of available providers on your machine. If your provider is in this list, run Import-PackageProvider -Name <MyProviderName> -Verbose

  1. If your provider does not show up in Get-PackageProvider -ListAvailable, it may be because the provider is not signed. In that case, try relaxing your execution policy with Set-ExecutionPolicy. After that, repeat step 1.

Why do my PowerShell functions return incorrect values sometimes?

If you are using a version of PackageManagement that is released before WMF5.0 RTM, then this may be caused by the use of Write-Verbose, Write-Debug, Write-Warning and Write-Error cmdlets in your functions. To fix this issue, use $null = Write-Verbose <your string> instead of Write-Verbose <your string>.

Can I pipe the return value of Find-Package to Install-Module and vice versa?

No, this will not work. Install-Module is a cmdlet specific to PowerShellGet provider whereas Find-Package is a general PackageManagement cmdlet (which means it may use a provider that is not PowerShellGet). You can pipe the result of Find-Package to Install-Package or pipe the result of Find-Module to Install-Module. Some examples of valid usage:

Find-Module -Name xjea | Install-Module -Verbose
Find-Package -Name jquery -ProviderName NuGet -Source http://www.nuget.org/api/v2/ | Install-Package -Destination C:\test -Verbose

Why am I getting a warning saying the module 'sysinternals' cannot be installed or updated because it is not a properly-formed module?

This is likely because you have registered https://chocolatey.org/api/v2/ source with the PowerShellGet provider. PowerShellGet provider only works with http://www.powershellgallery.com/api/v2/ so you will need to register https://chocolatey.org/api/v2/ source with Chocolatey provider via the command:

Register-PackageSource -Name chocolateysource -Location "https://chocolatey.org/api/v2/" –ProviderName Chocolatey

Why am I getting an error saying import-module could not load file or assembly?

If you are running Windows 7 or Windows Server 2008 and you want to upgrade to the latest version of PowerShellGet or PackageManagement, manually delete dlls under the top level folder C:\Program Files\WindowsPowerShell\Modules\PackageManagement\ and restart PowerShell.

Clone this wiki locally