PSResourceGet icon indicating copy to clipboard operation
PSResourceGet copied to clipboard

Install-PSResource should not require Prerelease for modules that don't have a stable version

Open ThomasNieto opened this issue 2 years ago • 1 comments

Prerequisites

  • [X] Write a descriptive title.
  • [X] Make sure you are able to repro it on the latest released version
  • [X] Search the existing issues.

Steps to reproduce

If a module does not have any stable versions then Install-PSResource should not require the use of Prerelease because all versions are prerelease.

It creates user confusion when it says the resource is not found on the repository when it does indeed exist.

Install-PSResource Microsoft.PowerShell.TextUtility
Install-PSResource: Package for installation could not be found due to: Package does not exist on the server.

Expected behavior

# Installs successfully

Actual behavior

Install-PSResource: Package for installation could not be found due to: Package does not exist on the server.

Error details

Exception             :
    Type    : Microsoft.PowerShell.PSResourceGet.UtilClasses.InvalidOrEmptyResponse
    Message : Package for installation could not be found due to: Package does not exist on the server.
    HResult : -2146233088
TargetObject          : Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallHelper
CategoryInfo          : InvalidOperation: (Microsoft.PowerShel…dlets.InstallHelper:InstallHelper) [Install-PSResource], InvalidOrEmptyResponse
FullyQualifiedErrorId : InstallPackageFailure,Microsoft.PowerShell.PSResourceGet.Cmdlets.InstallPSResource
InvocationInfo        :
    MyCommand        : Install-PSResource
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 47
    Line             : Install-PSResource Microsoft.PowerShell.TextUtility
    Statement        : Install-PSResource Microsoft.PowerShell.TextUtility
    PositionMessage  : At line:1 char:1
                       + Install-PSResource Microsoft.PowerShell.TextUtility
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Install-PSResource
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :

Environment data

7.4-preview4
beta22

Visuals

No response

ThomasNieto avatar Jul 11 '23 17:07 ThomasNieto

It does seem like it should, at the very least, let us know that there is a pre-release version available. Something like:

WARNING: No release version of Microsoft.PowerShell.TextUtility could be found on any server, but there is a pre-release version. To install pre-release versions, add the `-Prerelease` switch.

Jaykul avatar Sep 25 '23 17:09 Jaykul