WARNING: Unable to find module repositories

前端 未结 4 1606
半阙折子戏
半阙折子戏 2020-12-25 11:59

I tried to install Docker on activated windows server 2016 standard. I executed “Install-Module -Name DockerMsftProvider -Repository PSGallery -Force” but faile

相关标签:
4条回答
  • 2020-12-25 12:20

    My problem was the missing Proxy config

    best solution from comments: https://www.zerrouki.com/working-behind-a-proxy/
    thanks to @Vadzim


    In PowerShell open Profile

    PS> notepad $PROFILE
    

    this opens Notepad with your profile setting, will be created of not exists.
    then add:

    [system.net.webrequest]::defaultwebproxy = new-object system.net.webproxy('http://webproxy.yourCompany.com:PORT')
    [system.net.webrequest]::defaultwebproxy.credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
    [system.net.webrequest]::defaultwebproxy.BypassProxyOnLocal = $true
    

    somehow my local proxy is set but doesn't work. same problem later with Docker, =>

    > PS> [Environment]::SetEnvironmentVariable("HTTP_PROXY", http://username:password@proxy:port/", [EnvironmentVariableTarget]::Machine)
    

    then restart docker service

    0 讨论(0)
  • 2020-12-25 12:29

    Simply running Register-PSRepository -Default (without any additional parameters) worked for me. After that, the Gallery was successfully registered:

    PS C:\Windows\system32> Get-PSRepository
    
    Name                      InstallationPolicy   SourceLocation
    ----                      ------------------   --------------
    PSGallery                 Untrusted            https://www.powershellgallery.com/api/v2/
    
    0 讨论(0)
  • 2020-12-25 12:35

    With the deprecation of TLS 1.0 and 1.1 for PowerShell Gallery as of April 2020, the cmdlets Update-Module and Install-Module became broken. Thus, according to this article, some commands need to be executed to bring them alive again:

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

    If that still doesn't work, then run the following commands:

    [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
    Register-PSRepository -Default -Verbose
    Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
    

    TLS 1.0 and 1.1 were also recently deprecated at NuGet.org: But that was also previously announced.

    0 讨论(0)
  • 2020-12-25 12:43

    I got a similar message. I ran Register-PSRepository -default and it registered ok. Then I ran Set-PSRepository -Name PSGallery -InstallationPolicy Trusted. I didn't combine the commands, but it worked.

    I spent over an hour trying to pass credentials to the proxy the same way I do for Exchange Online, but no love. I disconnected and used our guest WiFi instead.

    0 讨论(0)
提交回复
热议问题