PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
485 stars 92 forks source link

Install-PSResource - Unable to install dot multiple-part named module #877

Closed wsmelton closed 1 year ago

wsmelton commented 1 year ago

Prerequisites

Steps to reproduce

  1. PowerShell session (PS 7.3.1 -- using VS Code Extension terminal as FYI but don't think this makes difference)
  2. Install latest release of PowerShellGet (3.0.17-beta17)
  3. Issue command: Install-PSResource 'PSRules.Rules.Azure' -Scope CurrentUser -Repository PSGallery
  4. Receive error:
Install-PSResource: Package 'PSRules.Rules.Azure' with requested version range '(, )' could not be installed as it was not found in any registered repositories

Expected behavior

Module is installed

https://www.powershellgallery.com/packages/PSRule.Rules.Azure/1.23.0-B0072

Actual behavior

Install-PSResource fails

Error details

PSMessageDetails      : 
Exception             : System.ArgumentException: Package 'PSRules.Rules.Azure' with requested version range '(, )' could not be installed as it was not found in any 
                        registered repositories
TargetObject          : 
CategoryInfo          : ObjectNotFound: (:) [Install-PSResource], ArgumentException
FullyQualifiedErrorId : ResourceNotFoundError,Microsoft.PowerShell.PowerShellGet.Cmdlets.InstallPSResource
ErrorDetails          : 
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1}

Environment data

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     3.0.17     beta17     PowerShellGet                       {Find-PSResource, Get-PSResource, Get-PSResourceRepository, Install-PSResource…}

Key   : PSVersion
Value : 7.3.1
Name  : PSVersion

Key   : PSEdition
Value : Core
Name  : PSEdition

Key   : GitCommitId
Value : 7.3.1
Name  : GitCommitId

Key   : OS
Value : Microsoft Windows 10.0.19042
Name  : OS

Key   : Platform
Value : Win32NT
Name  : Platform

Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0…}
Name  : PSCompatibleVersions

Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion

Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion

Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion

Visuals

image

wsmelton commented 1 year ago

May be something else going on because Find-Module is not showing the module exist either 🤷‍♂️

wsmelton commented 1 year ago
❯ Find-Module 'PSRules.Rules.Azure' -Repository PSGallery -AllowPrerelease -Debug
DEBUG: 00:00:00.0000009 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.0000124 Name: PSGallery
DEBUG: 00:00:00.0000176 Verbose: False
DEBUG: 00:00:00.0000216 ErrorVariable: ev
DEBUG: 00:00:00.0006237 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:00.0011073 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.0018348 Yielding package source for PSGallery at location https://www.powershellgallery.com/api/v2
DEBUG: 00:00:00.0023188 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0061006 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0061109 Name: PSGallery
DEBUG: 00:00:00.0061146 Verbose: False
DEBUG: 00:00:00.0061191 ErrorVariable: ev
DEBUG: 00:00:00.0067823 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
DEBUG: 00:00:00.0072875 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0080440 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0100009 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0100143 Name: PSGallery
DEBUG: 00:00:00.0100196 Verbose: False
DEBUG: 00:00:00.0100237 ErrorVariable: ev
DEBUG: 00:00:00.0107321 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
DEBUG: 00:00:00.0113593 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0122935 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0199343 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.0205926 Name: PSGallery
DEBUG: 00:00:00.0209018 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:00.0211844 Verbose: False
DEBUG: 00:00:00.0214517 ErrorVariable: ev
DEBUG: 00:00:00.0217334 ProviderName: PowerShellGet
DEBUG: 00:00:00.0228539 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:00.0236240 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.0267008 Yielding package source for PSGallery at location https://www.powershellgallery.com/api/v2
DEBUG: 00:00:00.0293105 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0316208 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.0321935 Name: PSGallery
DEBUG: 00:00:00.0325963 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:00.0331050 Verbose: False
DEBUG: 00:00:00.0333734 ErrorVariable: ev
DEBUG: 00:00:00.0336868 ProviderName: PowerShellGet
DEBUG: 00:00:00.0344785 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:00.0350922 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.0362669 Yielding package source for PSGallery at location https://www.powershellgallery.com/api/v2
DEBUG: 00:00:00.0390035 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0000011 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.0000204 Name: PSRules.Rules.Azure
DEBUG: 00:00:00.0000261 Source: PSGallery
DEBUG: 00:00:00.0000311 Debug: True
DEBUG: 00:00:00.0007250 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:00.0012833 In PowerShellGet Provider - 'Resolve-PackageSource'.
VERBOSE: Suppressed Verbose Repository details, Name = 'PSGallery', Location = 'https://www.powershellgallery.com/api/v2'; IsTrusted = 'True'; IsRegistered = 'True'.

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"): A
DEBUG: 00:00:00.0020978 Yielding package source for PSGallery at location https://www.powershellgallery.com/api/v2
DEBUG: 00:00:00.0028235 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0067188 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0067429 Name: PSRules.Rules.Azure
DEBUG: 00:00:00.0067528 Source: PSGallery
DEBUG: 00:00:00.0067605 Debug: True
DEBUG: 00:00:00.0088276 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
DEBUG: 00:00:00.0099499 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0109025 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0127891 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0127983 Name: PSRules.Rules.Azure
DEBUG: 00:00:00.0128033 Source: PSGallery
DEBUG: 00:00:00.0128078 Debug: True
DEBUG: 00:00:00.0134675 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
DEBUG: 00:00:00.0140012 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0161179 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0200077 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0200193 Name: PSRules.Rules.Azure
DEBUG: 00:00:00.0200239 Source: PSGallery
DEBUG: 00:00:00.0200296 Debug: True
DEBUG: 00:00:00.0208645 INVOKING PowerShell Fn Get-DynamicOptions with args Package that has length 1
DEBUG: 00:00:00.0214109 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0228014 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:02.6918564 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:02.6922054 Debug: True
DEBUG: 00:00:02.6924490 AllowPrereleaseVersions: True
DEBUG: 00:00:02.6926929 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:02.6929766 ProviderName: PowerShellGet
DEBUG: 00:00:02.6932390 Type: Module
DEBUG: 00:00:02.6934488 Name: PSRules.Rules.Azure
DEBUG: 00:00:02.6936738 Source: PSGallery
DEBUG: 00:00:02.6945006 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:02.6952602 In PowerShellGet Provider - 'Resolve-PackageSource'.
VERBOSE: Repository details, Name = 'PSGallery', Location = 'https://www.powershellgallery.com/api/v2'; IsTrusted = 'True'; IsRegistered = 'True'.
DEBUG: 00:00:02.6973626 Yielding package source for PSGallery at location https://www.powershellgallery.com/api/v2
DEBUG: 00:00:02.6982749 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:02.6984336 Calling SearchForPackages. Name='PSRules.Rules.Azure'
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
DEBUG: 00:00:02.6991741 PackageProvider::FindPackage with name PSRules.Rules.Azure
DEBUG: 00:00:02.6998220 Calling SearchForPackages After Select 1
DEBUG: 00:00:02.7015024 Calling New() : MethodName = 'FindPackage'
DEBUG: 00:00:02.7020906 Debug: True
DEBUG: 00:00:02.7024075 AllowPrereleaseVersions: True
DEBUG: 00:00:02.7027017 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:02.7030074 ProviderName: PowerShellGet
DEBUG: 00:00:02.7033303 Type: Module
DEBUG: 00:00:02.7035782 Name: PSRules.Rules.Azure
DEBUG: 00:00:02.7038241 Source: PSGallery
DEBUG: 00:00:02.7047793 INVOKING PowerShell Fn Find-Package with args System.String[], , ,  that has length 4
DEBUG: 00:00:02.7060574 In PowerShellGet Provider - 'Find-Package'.
DEBUG: 00:00:02.7064488 OPTION: Debug => True
DEBUG: 00:00:02.7067491 OPTION: AllowPrereleaseVersions => True
DEBUG: 00:00:02.7072201 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:02.7079817 OPTION: ProviderName => PowerShellGet
DEBUG: 00:00:02.7083181 OPTION: Type => Module
DEBUG: 00:00:02.7087029 OPTION: Name => PSRules.Rules.Azure
DEBUG: 00:00:02.7090156 OPTION: Source => PSGallery
VERBOSE: Using the specified source names : 'PSGallery'.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'.
DEBUG: 00:00:02.7151525 PackageProvider::FindPackage with name PSRules.Rules.Azure
DEBUG: 00:00:02.7193128 Calling 'NuGet'::'FindPackage' - name='PSRules.Rules.Azure', requiredVersion='',minimumVersion='', maximumVersion='''.
DEBUG: 00:00:02.7200102 Iterating 'PSRules.Rules.Azure'.
DEBUG: 00:00:02.7204651 There are '3' registered sources in 'NuGet' provider.
DEBUG: 00:00:02.7208523 Source 'https://www.powershellgallery.com/api/v2' is not one of the registered sources in 'NuGet' provider.
DEBUG: 00:00:02.7212183 Source 'https://www.powershellgallery.com/api/v2' is validated.
DEBUG: 00:00:02.7215429 Calling 'NuGetRequest'::'GetPackageById', 'PSRules.Rules.Azure'.
DEBUG: 00:00:02.7218586 Calling 'NuGetPackageRepository'::'FindPackagesById', 'PSRules.Rules.Azure'.
DEBUG: 00:00:02.7222500 Calling 'NuGetPackageFeed2'::'FindPackage', 'PSRules.Rules.Azure'.
DEBUG: 00:00:02.7226342 Calling 'NuGetClient'::'FindPackage'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PSRules.Rules.Azure'' for ''.
DEBUG: 00:00:02.7234681 Downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PSRules.Rules.Azure'&$skip=0&$top=40'.
DEBUG: 00:00:03.2492161 Completed downloading 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PSRules.Rules.Azure'&$skip=0&$top=40'.
DEBUG: 00:00:03.2500121 '0' packages received in the last request.
DEBUG: 00:00:03.2508366 System.ArgumentNullException: Value cannot be null. (Parameter 'source')
   at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Linq.Enumerable.GroupBy[TSource,TKey](IEnumerable`1 source, Func`2 keySelector)
   at Microsoft.PackageManagement.NuGetProvider.NuGetRequest.GetPackageById(PackageSource source, String name, NuGetRequest request, String requiredVersion, String minimumVersio
n, String maximumVersion, Boolean minInclusive, Boolean maxInclusive, Boolean isDependency)
VERBOSE: Total package yield:'0' for the specified package 'PSRules.Rules.Azure'.
DEBUG: 00:00:03.2531420 Completed iterating for 'PSRules.Rules.Azure'.
DEBUG: 00:00:03.2540107 Calling 'NuGetRequest'::'FindRegisteredSource', 'https://www.powershellgallery.com/api/v2'.
DEBUG: 00:00:03.2546494 PowerShell Script 'PSModule' Function 'Find-Package' returns null.
DEBUG: 00:00:03.2553313 Done calling powershell «Find-Package» «PSModule»
DEBUG: 00:00:03.2558727 unmatched package name='PSRules.Rules.Azure'
Find-Package: No match was found for the specified search criteria and module name 'PSRules.Rules.Azure'. Try Get-PSRepository to see all available registered module repositorie
s.
wsmelton commented 1 year ago

Running pwsh -noprofile allowed me to finally install this module.

image