这是我在互联网上找到的常见解决方案无法解决的常见错误。
无法运行 Get-PsRepository、Install-Module 和相关 (OneGet?) 命令,否则它们会抛出“无法找到模块提供程序 (PowerShellGet)”错误。这似乎是 NuGet 包管理器模块的问题,但我不知道如何恢复。安装的包提供程序似乎有效
症状模式:
C:> [Net.ServicePointManager]::SecurityProtocol
Tls12
Run Code Online (Sandbox Code Playgroud)
获取-PSRepository
PackageManagement\Get-PackageSource : Unable to find module providers (PowerShellGet).
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:4496 char:31
+ ... ckageSources = PackageManagement\Get-PackageSource @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.Power...etPackageSource:GetPackageSource) [Get-PackageSource
], Exception
+ FullyQualifiedErrorId : UnknownProviders,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageSource
Run Code Online (Sandbox Code Playgroud)
注册-PSRepository -Default -Verbose
VERBOSE: PowerShell meta provider initialization failed.
VERBOSE: No match was found for the specified search criteria and provider name 'PowerShellGet'. Try
'Get-PackageProvider -ListAvailable' to see if the provider exists on the …Run Code Online (Sandbox Code Playgroud)