OneGet / oneget

PackageManagement (aka OneGet) is a package manager for Windows
MIT License
2.38k stars 189 forks source link

Install-PackageProvider -Name NuGet not working after upgrade from WMF 4.0 to 5.0 #195

Closed favorini closed 7 years ago

favorini commented 8 years ago

Upgraded from WMF 4.0 to WMF 5.0 on Windows 7 SP1 x64 with .NET 4.6.1 and can't get NuGet/OneGet etc. to work at all. Already tried uninstall of WMF 5.0 and reinstall to no avail. Also tried Set-ExecutionPolicy Bypass--same error.

PS T:\> Install-PackageProvider -Name NuGet -ForceBootstrap
Install-PackageProvider : Unable to find repository with SourceLocation ''. Please use Get-PSRepository to see all 
available repositories. 
At line:1 char:1 
+ Install-PackageProvider -Name NuGet -ForceBootstrap 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+ CategoryInfo : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-Pac 
kageProvider], Exception 
+ FullyQualifiedErrorId : RegisterPackageSourceRequired,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPack 
ageProvider

PS T:\> Get-PSRepository
PackageManagement\Get-PackageSource : Unable to find module providers (PowerShellGet). 
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:3544 char:31 
+ ... ckageSources = PackageManagement\Get-PackageSource @PSBoundParameters 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+ CategoryInfo : InvalidArgument: (Microsoft.Power...etPackageSource:GetPackageSource) [Get-PackageSource 
], Exception 
+ FullyQualifiedErrorId : UnknownProviders,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageSource

PS T:\> Get-PackageProvider
PS T:\> Get-PackageProvider -ListAvailable -Verbose
VERBOSE: PowerShell meta provider initialization failed.
PS T:\> dir $env:ProgramFiles\PackageManagement\ProviderAssemblies
PS T:\> dir $env:LOCALAPPDATA\Microsoft\Windows\PowerShell\PowerShellGet
PS T:\> [environment]::OSVersion

Platform ServicePack    Version        VersionString
-------- -----------    -------        -------------
 Win32NT Service Pack 1 6.1.7601.65536 Microsoft Windows NT 6.1.7601 Service Pack 1

PS T:\> $PSVersionTable

Name Value 
---- ----- 
PSVersion 5.0.10586.117 
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} 
BuildVersion 10.0.10586.117 
CLRVersion 4.0.30319.42000 
WSManStackVersion 3.0 
PSRemotingProtocolVersion 2.3 
SerializationVersion 1.1.0.1

PS T:\> Get-ExecutionPolicy
RemoteSigned
lachlann562 commented 4 years ago

i was able to solve this by forcing TLS 1.2:

PS C:\Windows\system32> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

PS C:\Windows\system32> Install-PackageProvider nuget

Name Version Source Summary


nuget 2.8.5.208 https://onege... NuGet provider for the OneGet meta-package manager

Rajkishore123 commented 4 years ago

Got the same type of issue, check the below link, if this solution helps !!! Thanks.

https://azurelessons.com/unable-to-find-package-providers-nuget/