Closed chucklu closed 5 years ago
@alexandair
~\Desktop> Find-Module WindowsCompatibility
PackageManagement\Find-Package : No match was found for the specified search criteria and module name 'WindowsCompatibility'. Try Get-PSRepository to see all available registered module repositories.
At C:\program files\powershell\6\Modules\PowerShellGet\PSModule.psm1:8821 char:3
+ PackageManagement\Find-Package @PSBoundParameters | Microsoft ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage
Try Get-PSRepository to see all available registered module repositories.
@alexandair where is the location of module repositories?
~\Desktop> Get-PSRepository
WARNING: Unable to find module repositories.
@SteveL-MSFT Do you know where is the module repositories?
What Get-PSRepository
for? like NuGet?
@chucklu I don't know why you aren't showing any repositories, but you can do Register-PSRepository -Default
to get PowerShell gallery back
Hi @SteveL-MSFT ,
After Register-PSRepository -Default
still the same error.
Where is the source code of Register-PSRepository
function? I want to check the source code.
~\Desktop> Register-PSRepository -Default
~\Desktop> Get-PSRepository
WARNING: Unable to find module repositories.
@chucklu this appears to be an issue with PowerShellGet. I would suggest opening an issue there to continue this discussion. Closing this issue in this repo.
@SteveL-MSFT I have checked the parameters for the Register-PSRepositor, I have a default proxy on my computer, so it could be the proxy problem. I will open a new issue on PowerShellGet repository.
~\source\repos\GitHub\Other\PowerShellGet [development ≡ +0 ~2 -0 !]> ((Get-Command -Name Register-PSRepository).Parameters).Keys
Name
SourceLocation
PublishLocation
ScriptSourceLocation
ScriptPublishLocation
Credential
Default
InstallationPolicy
Proxy
ProxyCredential
PackageManagementProvider
Verbose
Debug
ErrorAction
WarningAction
InformationAction
ErrorVariable
WarningVariable
InformationVariable
OutVariable
OutBuffer
PipelineVariable
Hi @SteveL-MSFT , @alexandair I have register the ps repository successfully.
~\source\repos\GitHub\Other\PowerShellGet [development ≡]> Get-PSRepository
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Untrusted https://www.powershellgallery.com/api/v2
However, when I try to install this module , still failed
~\source\repos\GitHub\Other\PowerShellGet [development ≡]> Install-Module -Name WindowsCompatibility
WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'.
PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'WindowsCompatibility'. Try Get-PSRepository to see all available registered module repositories.
At C:\Users\clu\source\repos\GitHub\Other\PowerShellGet\PowerShellGet\public\psgetfunctions\Install-Module.ps1:169 char:21
+ ... $null = PackageManagement\Install-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
After check the parameters of the Install-Module , it still need the proxy parameter.
~\source\repos\GitHub\Other\PowerShellGet [development ≡]> Install-Module -Name WindowsCompatibility -Proxy "http://domain:port"
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): a
It works now
@chucklu glad you solved it! Seems like a better error message should have been given if it can't connect to the gallery due to proxy
@SteveL-MSFT I have submit a new issue in https://github.com/PowerShell/PowerShellGet about using the default proxy. NuGet works fine with my default proxy, I don't need to specify the proxy for it manually.
related to this issue https://github.com/PowerShell/PowerShell/issues/7811#issuecomment-422957296 what's the
module repositories
?