Open phonegi opened 4 years ago
I came across something like this just now. Out of curiosity, does it work if you specify add -AllowPrerelease
to your search? It's not likely to be fixed, but I think I found a bug here:
https://github.com/PowerShell/PowerShellGetv2/blob/8c61ce7687de813438b0698c6eb461f610aa25ca/src/PowerShellGet/public/psgetfunctions/Find-Module.ps1#L158
Specifically this part $psgetItemInfo.AdditionalMetadata.IsPrerelease -eq 'false'
. For a package that isn't prerelease, I don't think the AdditionalMetadata
will have an IsPrerelease
property, so $psgetItemInfo.AdditionalMetadata.IsPrerelease
will return $null
, so it essentially boils down to $null -eq 'false'
which is itself false, so it won't execute the part of the code that will return the package. So it will accidentally filter out every package unless you specify -AllowPrerelease
which will then also return PreRelease packages.
Easy enough to fix, assuming my assumption that Find-Package won't set an IsPrerelease property when it's not prerelease. But I doubt it will happen since all the work is happening on v3.
For a package that isn't prerelease $psgetItemInfo.AdditionalMetadata.IsPrerelease
is actually a boolean False
which does not equal to the string false
.
I have just suddenly hit this issue and I do not understand how this happened. Seems like PackageManagement\Find-Package
version does not match that of PowerShellGet\Find-Module
In my case I have PackageManagement 1.4.7, but PowerShellGet 2.2.4.1
I do not understand why it started to happen suddenly. Some kind of an auto update.
OK, I figured out the root cause. Another script loads the latest version of PowerShellGet which overshadows the old one. But this latest version is broken! Find-Module -AllVersions
is broken and the fix is trivial - just do not compare with the 'false'
string! Use !$psgetItemInfo.AdditionalMetadata.IsPrerelease
instead or add it as an OR clause.
Is anyone looking at this one at all! This is frustrating.
@FISHMANPET I was having the same issue with some modules I downloaded from the PSGallery using save-module and save-package. I can find-module in my local repository but only if I specify the -RequiredVersion. Using -AllowPrerelease shows me all the modules in the local repository. Thx!
I came across something like this just now. Out of curiosity, does it work if you specify add
-AllowPrerelease
to your search? It's not likely to be fixed, but I think I found a bug here:Specifically this part
$psgetItemInfo.AdditionalMetadata.IsPrerelease -eq 'false'
. For a package that isn't prerelease, I don't think theAdditionalMetadata
will have anIsPrerelease
property, so$psgetItemInfo.AdditionalMetadata.IsPrerelease
will return$null
, so it essentially boils down to$null -eq 'false'
which is itself false, so it won't execute the part of the code that will return the package. So it will accidentally filter out every package unless you specify-AllowPrerelease
which will then also return PreRelease packages. Easy enough to fix, assuming my assumption that Find-Package won't set an IsPrerelease property when it's not prerelease. But I doubt it will happen since all the work is happening on v3.
I've tested and believe that on line 158, 'false' should be replaced with $false as is done in the Find-Script.ps1 for the same functionality.
In my local repository, my packages have IsPrerelease=False, where as the ones on PSGallery seem to have IsPrerelease=false
And three years later...
Hi @DennisL68, we're no longer working on this repository, see the read me. Please try PSResourceGet for continued improvements on what was previously PowerShellGet
A Windows PowerShell v5.1 session:
A PowerShell Core 6.0 session: