Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Update-Module fails to update modules with an error: Install-Package unable to find repository 'https://www.powershellgallery.com/api/v2/'  #473

@tristanbarcelon

Description

@tristanbarcelon

Steps to reproduce
(assume you have Az module from PSGallery installed and do not update PowershellGet version. Use the stock version of PowershellGet that comes with Windows 10, in this case 1903)

Update-Module

Expected behavior

all modules installed previously from PSGallery will be updated successfully

Actual behavior

PackageManagement\Install-Package : Unable to find repository 'https://www.powershellgallery.com/api/v2/'. Use Get-PSRepository to see all available repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2089 char:20
+ ...           $sid = PackageManagement\Install-Package @PSBoundParameters

Environment data

> $PSVersionTable

Name                           Value                                                                                                                                    
----                           -----                                                                                                                                    
PSVersion                      5.1.18362.1                                                                                                                              
PSEdition                      Desktop                                                                                                                                  
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                  
BuildVersion                   10.0.18362.1                                                                                                                             
CLRVersion                     4.0.30319.42000                                                                                                                          
WSManStackVersion              3.0                                                                                                                                      
PSRemotingProtocolVersion      2.3                                                                                                                                      
SerializationVersion           1.1.0.1
> Get-Module -ListAvailable PowerShellGet,PackageManagement

ModuleType Version    Name                                ExportedCommands                                                                                              
---------- -------    ----                                ----------------                                                                                              
Script     1.3.1      PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}                                        
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}                                        
Script     2.1.2      PowerShellGet                       {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}                                         
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}       
> Get-PackageProvider -ListAvailable
Name                     Version          DynamicOptions                                                                                                                
----                     -------          --------------                                                                                                                
msi                      3.0.0.0          AdditionalArguments                                                                                                           
msu                      3.0.0.0                                                                                                                                        
nuget                    2.8.5.208                                                                                                                                      
NuGet                    3.0.0.1          Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions, ConfigFile, ...
PowerShellGet            2.1.2.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowPrereleaseVersi...
PowerShellGet            1.0.0.1                                                                                                                                        
Programs                 3.0.0.0          IncludeWindowsInstaller, IncludeSystemComponent

Fix

> Install-Module -Name PowershellGet -Repository PSGallery -Force

close the existing powershell or ISE session and start a new one

> Update-Module

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions