Publish-Module cmdlet fails

Overview

I wanted to create a private PowerShell gallery and ran the Publish-Module cmdlet to register the module and got an error.
What I want to do is register it with the Publish-Module cmdlet and install it with the Install-Module cmdlet.
Please point out any excesses or errors.

Details

The steps I performed are as follows.

Configure the registry

dotnet nuget add source --name {source_name} --username {username} --password {password} https://gitea.example.com/api/packages/{owner}/ nuget/index.json

register package source

Register-PSRepository -Name “GiteaRepo” -SourceLocation https://gitea.example.com/api/packages/{owner}/nuget/index.json - PublishLocation https://gitea.example.com/api/packages/{owner}/nuget/v2/package

Publish module.

> Publish-Module -Path {modulepath} -Repository GiteaRepo -NuGetApiKey {pat}
Write-Error: Failed to generate the compressed file for module 'Cannot index into a null array.'.
>