NuGet Package Registry for PowerShell Modules

My goal is using Gitea as a registry for custom PowerShell modules.
To a certain level it also works fine, but some things don’t work as expected and I am not sure if it is a bug, a limitation or wrong usage.

I created this repo with a test module: GitHub - marvint24/PWSHTest

Registering, publishing works fine, but installing fails.


Install-Module -Name PWSHTest -Repository Gitea

Result:

Install-Package: No match was found for the specified search criteria and module name 'PWSHTest'. Try Get-PSRepository to see all
available registered module repositories.

But I can find it with:

Find-Module -Name * -Repository Gitea

Result:

Version              Name                                Repository           Description
-------              ----                                ----------           -----------
0.1.3                PWSHTest                            Gitea                A test PowerShell module

If I try to find it directly by name Find-Module -Name PWSHTest -Repository Gitea it also fails.

I wanted to know if it is a problem with Gitea or with my module / publish process and I installed Sonartype Nexus.
This seams to work fine, no problems with finding or installing modules.

After this I went down the PowerShell Module rabbit hole deeper and found out that there are also different modules in PowerShell to handle modules. This is what I found out:

Name PowerShell Version Commands Works with Gitea
PowerShellGet 5.1 - Installs itself on first run
7 - Installs itself on first run
Register-PSRepository, Unregister-PSRepository
Get-PSRepository
Publish-Module
Install-Module, Uninstall-Module
Find-Module
Publish ✅
Find ➖ Only * finds the modules
Install ❌
Update ❌
PSResourceGet 5.1 - Install
7 - Already installed
Register-PSResourceRepository, Unregister-PSResourceRepository
Get-PSResourceRepository
Publish-PSResource
Install-PSResource, Uninstall-PSResource
Find-PSResource
Publish ✅
Find ➖ Find * doesn't work
Install ✅ Installing dependencies is not supported
Update ✅ Installing dependencies is not supported

Does anyone have tips or directions what I could do next? With PSResourceGet I found a way that works, but I think it is not ideal.

I’ve been seeing similar issues to yours. Publishing works fine, and sometimes I can even Find-Module -Name PWSHTest -Repository Gitea but install never works. The issue seems to be a miscommunication between Gitea & PowerShellGet

Find-Module -Name PWSHTest -Repository Gitea -Verbose
VERBOSE: Suppressed Verbose Repository details, Name = 'Gitea', Location = 'https://gitea.xxx.com/api/packages/audrey/nuget/index.json'; IsTrusted = 'True'; IsRegistered = 'True'.
VERBOSE: Repository details, Name = 'Gitea', Location = 'https://gitea.xxx.com/api/packages/audrey/nuget/index.json'; IsTrusted = 'True'; IsRegistered = 'True'.
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
VERBOSE: Using the specified source names : 'Gitea'.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://gitea.xxx.com/api/packages/audrey/nuget/index.json' and PackageManagementProvider is 'NuGet'.
VERBOSE: Retry downloading 'https://gitea.xxx.com/api/packages/audrey/nuget/registration/pwshtest/1.1.json' for '0' more times
VERBOSE: Total package yield:'0' for the specified package 'PWSHTest'.
Find-Package: No match was found for the specified search criteria and module name 'PWSHTest'. Try Get-PSRepository to see all available registered module repositories.

Navigating to https://gitea.xxx.com/api/packages/audrey/nuget/registration/PWSHTest/1.1.json fails, but https://gitea.xxx.com/api/packages/audrey/nuget/registration/PWSHTest/1.1.0.json works.
I’m looking for a workaround to make this work, but so far nothing I’ve tried has helped.

1 Like

I created an issue on github: Use NuGet Package Registry for PowerShell Modules · Issue #34486 · go-gitea/gitea · GitHub

1 Like

Been poking at this a bit more this morning. I haven’t been able to make it work, but I have determined the issue is that PowerShellGet requires a NuGet v2 feed. Despite documentation’s claim otherwise, Gitea fails to completely implement v2 (only the ‘packages’ endpoint is routable.)

Given PowerShellGet is being phased out in favor of PSResouceGet, I’m not sure it’s worth correcting this. I’m resolving myself to just using PSResourceGet & manually installing dependencies.
Supposedly this automation is coming (backed by the good word of Microsoft :roll_eyes:)
Per Microsoft Documentation:

Install-PSResource doesn’t install dependent resources from repositories that use the NuGet v3 protocol. You must install the dependent resources individually. We intend to add this feature in a future release.

1 Like