question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to install modules using the powershellget install-module commandlet

See original GitHub issue

Describe the bug

I’m unable to install from (though I am able to publish to) PowerShell modules using the Install-Module PowerShell commandlet in PowerShellGet, which is the recommended way to install PowerShell modules from a NuGet feed.

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of BaGet: 'Hand build into a docker image, using the master branch of the repo on 1/30/2019"
  2. Run this code ‘sudo docker run --rm --name baget-server -p 5555:80 --env-file baget.env -v "$(pwd)/baget-data:/var/baget" junkiebev/baget:v1.0.0’ - the baget.env file contains the content currently documented on the website
  3. Reproduce error
  • Download and extract to a directory a powershell module from the PowerShell gallery and extract it. In this case, I used Write-ObjecToSQL version 1.13.
  • Register a PowerShell Repository
    $repo = @{
        Name = 'baget'
        SourceLocation = "http://chd9fmks1dt.COMPANY.com:5555/v3/index.json"
        PublishLocation = "http://chd9fmks1dt.COMPANY.com:5555/v3/index.json"
        InstallationPolicy = 'Trusted'
    }
    Register-PSRepository @repo



  • Publish the package: Publish-Module -Path .\Write-ObjectToSQL -Repository baget -NuGetApiKey "NUGET-SERVER-API-KEY"
  • The package shows up in the website UI
  • The package shows up if you query all of the packages in that repo
Find-Module -Repository baget | select *


Name                       : Write-ObjectToSQL
Version                    : 1.13.0
Type                       : Module
Description                : Writes the properties of an object into a database table. The table will be created if it doesnt exist.
Author                     : John Roos
CompanyName                : 
Copyright                  : 
PublishedDate              : 
InstalledDate              : 
UpdatedDate                : 
LicenseUri                 : 
ProjectUri                 : https://github.com/JohnRoos/PowerShell/tree/master/Modules/Write-ObjectToSQL
IconUri                    : 
Tags                       : {Database,, SQLServer,, Object,, PSModule,}
Includes                   : {Function, RoleCapability, Command, DscResource...}
PowerShellGetFormatVersion : 
ReleaseNotes               : 
Dependencies               : {}
RepositorySourceLocation   : baget
Repository                 : baget
PackageManagementProvider  : NuGet
AdditionalMetadata         : @{summary=Writes the properties of an object into a database table. The table will be created if it doesnt exist.; isLatestVersion=False; 
                             developmentDependency=False; downloadCount=0; description=Writes the properties of an object into a database table. The table will be created 
                             if it doesnt exist.; PackageManagementProvider=NuGet; tags=Database, SQLServer, Object, PSModule, PSIncludes_Cmdlet, 
                             PSCmdlet_Write-ObjectToSQL, PSIncludes_Function, PSFunction_Write-ObjectToSQL, PSCommand_Write-ObjectToSQL; isAbsoluteLatestVersion=False; 
                             SourceName=baget; requireLicenseAcceptance=False; IsPrerelease=False}
  • Searching for the specific module results in this error
Find-Module -Repository baget -name "Write-ObjectToSQL" -Debug
DEBUG: 00:00:00.0000002 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.0000183 Verbose: False
DEBUG: 00:00:00.0000292 Name: baget
DEBUG: 00:00:00.0000393 ErrorVariable: ev
DEBUG: 00:00:00.0007650 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:00.0014202 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.0027318 Yielding package source for baget at location http://chd9fmks1dt.COMPANY.com:5555/v3/index.json
DEBUG: 00:00:00.0035762 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0066347 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0066552 Verbose: False
DEBUG: 00:00:00.0066694 Name: baget
DEBUG: 00:00:00.0066833 ErrorVariable: ev
DEBUG: 00:00:00.0073400 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
DEBUG: 00:00:00.0080542 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0090752 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0145703 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0145883 Verbose: False
DEBUG: 00:00:00.0145992 Name: baget
DEBUG: 00:00:00.0146101 ErrorVariable: ev
DEBUG: 00:00:00.0152726 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
DEBUG: 00:00:00.0158758 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0174636 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:02.3101001 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:02.3114422 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:02.3126685 ProviderName: PowerShellGet
DEBUG: 00:00:02.3198120 Verbose: False
DEBUG: 00:00:02.3210457 Name: baget
DEBUG: 00:00:02.3220960 ErrorVariable: ev
DEBUG: 00:00:02.3235037 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:02.3251107 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:02.3276147 Yielding package source for baget at location http://chd9fmks1dt.COMPANY.com:5555/v3/index.json
DEBUG: 00:00:02.3289420 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:02.3356718 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:02.3367740 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:02.3378105 ProviderName: PowerShellGet
DEBUG: 00:00:02.3387118 Verbose: False
DEBUG: 00:00:02.3393995 Name: baget
DEBUG: 00:00:02.3405819 ErrorVariable: ev
DEBUG: 00:00:02.3418323 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:02.3425986 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:02.3442806 Yielding package source for baget at location http://chd9fmks1dt.COMPANY.com:5555/v3/index.json
DEBUG: 00:00:02.3453762 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0000001 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.0000237 Debug: True
DEBUG: 00:00:00.0000381 Source: baget
DEBUG: 00:00:00.0000508 Name: Write-ObjectToSQL
DEBUG: 00:00:00.0008141 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:00.0015087 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.0031133 Yielding package source for baget at location http://chd9fmks1dt.COMPANY.com:5555/v3/index.json
DEBUG: 00:00:00.0039927 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0070571 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0070779 Debug: True
DEBUG: 00:00:00.0070919 Source: baget
DEBUG: 00:00:00.0071047 Name: Write-ObjectToSQL
DEBUG: 00:00:00.0099547 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
DEBUG: 00:00:00.0107296 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0118169 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0148330 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0148528 Debug: True
DEBUG: 00:00:00.0148665 Source: baget
DEBUG: 00:00:00.0148793 Name: Write-ObjectToSQL
DEBUG: 00:00:00.0155468 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
DEBUG: 00:00:00.0162440 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0180098 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0232328 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0232557 Debug: True
DEBUG: 00:00:00.0232694 Source: baget
DEBUG: 00:00:00.0232821 Name: Write-ObjectToSQL
DEBUG: 00:00:00.0240991 INVOKING PowerShell Fn Get-DynamicOptions with args Package that has length 1
DEBUG: 00:00:00.0248401 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0282863 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.7397806 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.7408836 ProviderName: PowerShellGet
DEBUG: 00:00:00.7423086 Type: Module
DEBUG: 00:00:00.7436397 Source: baget
DEBUG: 00:00:00.7450176 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:00.7480055 Debug: True
DEBUG: 00:00:00.7486322 Name: Write-ObjectToSQL
DEBUG: 00:00:00.7495547 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:00.7502774 In PowerShellGet Provider - 'Resolve-PackageSource'.
VERBOSE: Repository details, Name = 'baget', Location = 'http://chd9fmks1dt.COMPANY.com:5555/v3/index.json'; IsTrusted = 'True'; IsRegistered = 'True'.
DEBUG: 00:00:01.8641825 Yielding package source for baget at location http://chd9fmks1dt.COMPANY.com:5555/v3/index.json
DEBUG: 00:00:01.8671617 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:01.8672944 Calling SearchForPackages. Name='Write-ObjectToSQL'
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
DEBUG: 00:00:01.8690369 PackageProvider::FindPackage with name Write-ObjectToSQL
DEBUG: 00:00:01.8696576 Calling SearchForPackages After Select 1
DEBUG: 00:00:01.8787970 Calling New() : MethodName = 'FindPackage'
DEBUG: 00:00:01.8793519 ProviderName: PowerShellGet
DEBUG: 00:00:01.8798899 Type: Module
DEBUG: 00:00:01.8804651 Source: baget
DEBUG: 00:00:01.8810067 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:01.8815496 Debug: True
DEBUG: 00:00:01.8820819 Name: Write-ObjectToSQL
DEBUG: 00:00:01.8913914 INVOKING PowerShell Fn Find-Package with args System.String[], , ,  that has length 4
DEBUG: 00:00:01.8927613 In PowerShellGet Provider - 'Find-Package'.
DEBUG: 00:00:01.8940210 OPTION: ProviderName => PowerShellGet
DEBUG: 00:00:01.8955056 OPTION: Type => Module
DEBUG: 00:00:01.8970041 OPTION: Source => baget
DEBUG: 00:00:01.8993245 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:01.9001381 OPTION: Debug => True
DEBUG: 00:00:01.9008272 OPTION: Name => Write-ObjectToSQL
VERBOSE: Using the specified source names : 'baget'.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'http://chd9fmks1dt.COMPANY.com:5555/v3/index.json' and PackageManagementProvider is 'NuGet'.
DEBUG: 00:00:01.9069217 PackageProvider::FindPackage with name Write-ObjectToSQL
DEBUG: 00:00:01.9093828 Calling 'NuGet'::'FindPackage' - name='Write-ObjectToSQL', requiredVersion='',minimumVersion='', maximumVersion='''.
DEBUG: 00:00:01.9106513 Iterating 'Write-ObjectToSQL'.
DEBUG: 00:00:01.9117811 There are '7' registered sources in 'NuGet' provider.
DEBUG: 00:00:01.9123819 Source 'http://chd9fmks1dt.COMPANY.com:5555/v3/index.json' is not one of the registered sources in 'NuGet' provider.
DEBUG: 00:00:01.9129773 Source 'http://chd9fmks1dt.COMPANY.com:5555/v3/index.json' is validated.
DEBUG: 00:00:01.9144181 Calling 'NuGetRequest'::'GetPackageById', 'Write-ObjectToSQL'.
DEBUG: 00:00:01.9173521 Calling 'NuGetPackageRepository'::'FindPackagesById', 'Write-ObjectToSQL'.
DEBUG: 00:00:01.9192746 Calling 'NuGetPackageFeed3'::'Find', 'Write-ObjectToSQL'.
DEBUG: 00:00:01.9236241 Calling 'NuGetPackageFeed3'::'FindImpl', 'Write-ObjectToSQL'.
DEBUG: 00:00:01.9250263 Returning the call 'NuGetPackageFeed3'::'FindImpl'.
DEBUG: 00:00:01.9263363 Returning the call 'NuGetPackageFeed3'::'Find'.
DEBUG: 00:00:01.9274801 Calling 'NuGetPackageFeed3'::'Find', 'http://chd9fmks1dt.COMPANY.com:5555/v3/registration/write-objecttosql/index.json'.
DEBUG: 00:00:01.9283043 Downloading 'http://chd9fmks1dt.COMPANY.com:5555/v3/registration/write-objecttosql/index.json'.
DEBUG: 00:00:02.0650665 Completed downloading 'http://chd9fmks1dt.COMPANY.com:5555/v3/registration/write-objecttosql/index.json'.
**WARNING: An internal error occurred: The JSON object returned by the NuGet API does not match expected schema. Expected property: 'type'. Check the debug stream for the ful
l JSON object dump.**
DEBUG: 00:00:07.0706095 System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Object.GetType()
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenDynamic(Object obj, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenDynamic(Object obj, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenDynamic(Object obj, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenDynamic(Object obj, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.Serialize(Object obj, String numericalPrefix)
   at Microsoft.PackageManagement.NuGetProvider.NuGetPackageFeed3.Find(String registrationUrl, NuGetSearchContext context, RequestWrapper request, Boolean finalAttempt)
   at Microsoft.PackageManagement.NuGetProvider.NuGetPackageFeed3.<GetPackagesForBaseUrl>d__6.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
   at Microsoft.PackageManagement.NuGetProvider.NuGetRequest.GetPackageById(PackageSource source, String name, NuGetRequest request, String requiredVersion, String minimumV
ersion, String maximumVersion, Boolean minInclusive, Boolean maxInclusive, Boolean isDependency)
VERBOSE: Total package yield:'0' for the specified package 'Write-ObjectToSQL'.
DEBUG: 00:00:07.0708165 Completed iterating for 'Write-ObjectToSQL'.
DEBUG: 00:00:07.0710982 PowerShell Script 'PSModule' Function 'Find-Package' returns null.
DEBUG: 00:00:07.0718265 Done calling powershell «Find-Package» «PSModule»
DEBUG: 00:00:09.8244323 unmatched package name='Write-ObjectToSQL'
PackageManagement\Find-Package : No match was found for the specified search criteria and package name 'Write-ObjectToSQL'. Try Get-PackageSource to see all available 
registered package sources.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.0.4\PSModule.psm1:8665 char:9
+         PackageManagement\Find-Package @PSBoundParameters | Microsoft ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage
  • Trying to install the module results in this error
Install-Module -Repository baget -name "Write-ObjectToSQL" -Debug
DEBUG: 00:00:00.0000004 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.0000228 Verbose: False
DEBUG: 00:00:00.0000353 Name: baget
DEBUG: 00:00:00.0000467 ErrorVariable: ev
DEBUG: 00:00:00.0008362 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:00.0014993 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.0030105 Yielding package source for baget at location http://chd9fmks1dt.COMPANY.com:5555/v3/index.json
DEBUG: 00:00:00.0036451 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0063936 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0064153 Verbose: False
DEBUG: 00:00:00.0064282 Name: baget
DEBUG: 00:00:00.0064398 ErrorVariable: ev
DEBUG: 00:00:00.0070384 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
DEBUG: 00:00:00.0076594 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0089282 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0133586 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0133779 Verbose: False
DEBUG: 00:00:00.0133900 Name: baget
DEBUG: 00:00:00.0134015 ErrorVariable: ev
DEBUG: 00:00:00.0140821 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
DEBUG: 00:00:00.0146978 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0163478 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:11.9050709 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:11.9062422 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:11.9075975 ProviderName: PowerShellGet
DEBUG: 00:00:11.9086908 Verbose: False
DEBUG: 00:00:11.9127355 Name: baget
DEBUG: 00:00:11.9138999 ErrorVariable: ev
DEBUG: 00:00:11.9151423 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:11.9162108 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:11.9184633 Yielding package source for baget at location http://chd9fmks1dt.COMPANY.com:5555/v3/index.json
DEBUG: 00:00:11.9195177 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:11.9256904 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:11.9267968 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:11.9279345 ProviderName: PowerShellGet
DEBUG: 00:00:11.9289447 Verbose: False
DEBUG: 00:00:11.9299716 Name: baget
DEBUG: 00:00:11.9324373 ErrorVariable: ev
DEBUG: 00:00:11.9333411 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:11.9341198 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:11.9359295 Yielding package source for baget at location http://chd9fmks1dt.COMPANY.com:5555/v3/index.json
DEBUG: 00:00:11.9376894 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0000002 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.0000229 Debug: True
DEBUG: 00:00:00.0000364 Source: baget
DEBUG: 00:00:00.0000490 Name: Write-ObjectToSQL
DEBUG: 00:00:00.0008258 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:00.0014813 In PowerShellGet Provider - 'Resolve-PackageSource'.
DEBUG: 00:00:00.0030646 Yielding package source for baget at location http://chd9fmks1dt.COMPANY.com:5555/v3/index.json
DEBUG: 00:00:00.0038756 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:00.0071031 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0071254 Debug: True
DEBUG: 00:00:00.0071395 Source: baget
DEBUG: 00:00:00.0071524 Name: Write-ObjectToSQL
DEBUG: 00:00:00.0081059 INVOKING PowerShell Fn Get-DynamicOptions with args Provider that has length 1
DEBUG: 00:00:00.0088501 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0099670 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0153140 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0153356 Debug: True
DEBUG: 00:00:00.0153531 Source: baget
DEBUG: 00:00:00.0153660 Name: Write-ObjectToSQL
DEBUG: 00:00:00.0160483 INVOKING PowerShell Fn Get-DynamicOptions with args Source that has length 1
DEBUG: 00:00:00.0167280 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0185754 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0214900 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0215104 Debug: True
DEBUG: 00:00:00.0215242 Source: baget
DEBUG: 00:00:00.0215370 Name: Write-ObjectToSQL
DEBUG: 00:00:00.0222637 INVOKING PowerShell Fn Get-DynamicOptions with args Package that has length 1
DEBUG: 00:00:00.0258338 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0288161 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.0315318 Calling New() : MethodName = 'GetDynamicOptions'
DEBUG: 00:00:00.0315625 Debug: True
DEBUG: 00:00:00.0315900 Source: baget
DEBUG: 00:00:00.0316220 Name: Write-ObjectToSQL
DEBUG: 00:00:00.0322440 INVOKING PowerShell Fn Get-DynamicOptions with args Install that has length 1
DEBUG: 00:00:00.0328627 In PowerShellGet Provider - 'Get-DynamicOptions'.
DEBUG: 00:00:00.0353943 Done calling powershell «Get-DynamicOptions» «PSModule»
DEBUG: 00:00:00.7935535 Calling New() : MethodName = 'ResolvePackageSources'
DEBUG: 00:00:00.8107264 ProviderName: PowerShellGet
DEBUG: 00:00:00.8128459 Type: Module
DEBUG: 00:00:00.8148437 Source: baget
DEBUG: 00:00:00.8160475 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:00.8168084 Debug: True
DEBUG: 00:00:00.8173784 Scope: AllUsers
DEBUG: 00:00:00.8179547 Name: Write-ObjectToSQL
DEBUG: 00:00:00.8190822 INVOKING PowerShell Fn Resolve-PackageSource with args  that has length 0
DEBUG: 00:00:00.8199872 In PowerShellGet Provider - 'Resolve-PackageSource'.
VERBOSE: Repository details, Name = 'baget', Location = 'http://chd9fmks1dt.COMPANY.com:5555/v3/index.json'; IsTrusted = 'True'; IsRegistered = 'True'.
DEBUG: 00:00:01.5326012 Yielding package source for baget at location http://chd9fmks1dt.COMPANY.com:5555/v3/index.json
DEBUG: 00:00:01.5351718 Done calling powershell «Resolve-PackageSource» «PSModule»
DEBUG: 00:00:01.5352864 Calling SearchForPackages. Name='Write-ObjectToSQL'
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
DEBUG: 00:00:01.5360601 PackageProvider::FindPackage with name Write-ObjectToSQL
DEBUG: 00:00:01.5362990 Calling SearchForPackages After Select 1
DEBUG: 00:00:01.5479273 Calling New() : MethodName = 'FindPackage'
DEBUG: 00:00:01.5488644 ProviderName: PowerShellGet
DEBUG: 00:00:01.5495488 Type: Module
DEBUG: 00:00:01.5500860 Source: baget
DEBUG: 00:00:01.5507664 MessageResolver: Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:01.5515186 Debug: True
DEBUG: 00:00:01.5521165 Scope: AllUsers
DEBUG: 00:00:01.5527085 Name: Write-ObjectToSQL
DEBUG: 00:00:01.5538041 INVOKING PowerShell Fn Find-Package with args System.String[], , ,  that has length 4
DEBUG: 00:00:01.5568814 In PowerShellGet Provider - 'Find-Package'.
DEBUG: 00:00:01.5579014 OPTION: ProviderName => PowerShellGet
DEBUG: 00:00:01.5591875 OPTION: Type => Module
DEBUG: 00:00:01.5603481 OPTION: Source => baget
DEBUG: 00:00:01.5615649 OPTION: MessageResolver => Microsoft.PowerShell.PackageManagement.Cmdlets.GetMessageString
DEBUG: 00:00:01.5624513 OPTION: Debug => True
DEBUG: 00:00:01.5631564 OPTION: Scope => AllUsers
DEBUG: 00:00:01.5639078 OPTION: Name => Write-ObjectToSQL
VERBOSE: Using the specified source names : 'baget'.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'http://chd9fmks1dt.COMPANY.com:5555/v3/index.json' and PackageManagementProvider is 'NuGet'.
DEBUG: 00:00:01.5707227 PackageProvider::FindPackage with name Write-ObjectToSQL
DEBUG: 00:00:01.5749013 Calling 'NuGet'::'FindPackage' - name='Write-ObjectToSQL', requiredVersion='',minimumVersion='', maximumVersion='''.
DEBUG: 00:00:01.5762978 Iterating 'Write-ObjectToSQL'.
DEBUG: 00:00:01.5782721 There are '7' registered sources in 'NuGet' provider.
DEBUG: 00:00:01.5789097 Source 'http://chd9fmks1dt.COMPANY.com:5555/v3/index.json' is not one of the registered sources in 'NuGet' provider.
DEBUG: 00:00:01.5978660 Source 'http://chd9fmks1dt.COMPANY.com:5555/v3/index.json' is validated.
DEBUG: 00:00:01.5986419 Calling 'NuGetRequest'::'GetPackageById', 'Write-ObjectToSQL'.
DEBUG: 00:00:01.5999263 Calling 'NuGetPackageRepository'::'FindPackagesById', 'Write-ObjectToSQL'.
DEBUG: 00:00:01.6047290 Calling 'NuGetPackageFeed3'::'Find', 'Write-ObjectToSQL'.
DEBUG: 00:00:01.6229992 Calling 'NuGetPackageFeed3'::'FindImpl', 'Write-ObjectToSQL'.
DEBUG: 00:00:01.6246863 Returning the call 'NuGetPackageFeed3'::'FindImpl'.
DEBUG: 00:00:01.6260832 Returning the call 'NuGetPackageFeed3'::'Find'.
DEBUG: 00:00:01.6274445 Calling 'NuGetPackageFeed3'::'Find', 'http://chd9fmks1dt.COMPANY.com:5555/v3/registration/write-objecttosql/index.json'.
DEBUG: 00:00:01.6287943 Downloading 'http://chd9fmks1dt.COMPANY.com:5555/v3/registration/write-objecttosql/index.json'.
DEBUG: 00:00:01.7679675 Completed downloading 'http://chd9fmks1dt.COMPANY.com:5555/v3/registration/write-objecttosql/index.json'.
WARNING: An internal error occurred: The JSON object returned by the NuGet API does not match expected schema. Expected property: 'type'. Check the debug stream for the ful
l JSON object dump.
DEBUG: 00:00:06.6493491 System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Object.GetType()
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenDynamic(Object obj, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenDynamic(Object obj, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenDynamic(Object obj, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenObject(Object o, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.FlattenDynamic(Object obj, String numericalPrefix, Int32 currentFlattenDepth, Int32& maxFlattenDepth)
   at Microsoft.PackageManagement.NuGetProvider.DynamicJsonParser.Serialize(Object obj, String numericalPrefix)
   at Microsoft.PackageManagement.NuGetProvider.NuGetPackageFeed3.Find(String registrationUrl, NuGetSearchContext context, RequestWrapper request, Boolean finalAttempt)
   at Microsoft.PackageManagement.NuGetProvider.NuGetPackageFeed3.<GetPackagesForBaseUrl>d__6.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
   at Microsoft.PackageManagement.NuGetProvider.NuGetRequest.GetPackageById(PackageSource source, String name, NuGetRequest request, String requiredVersion, String minimumV
ersion, String maximumVersion, Boolean minInclusive, Boolean maxInclusive, Boolean isDependency)
VERBOSE: Total package yield:'0' for the specified package 'Write-ObjectToSQL'.
DEBUG: 00:00:06.6672280 Completed iterating for 'Write-ObjectToSQL'.
DEBUG: 00:00:06.6678823 PowerShell Script 'PSModule' Function 'Find-Package' returns null.
DEBUG: 00:00:06.6690108 Done calling powershell «Find-Package» «PSModule»
DEBUG: 00:00:06.6702310 unmatched package name='Write-ObjectToSQL'
PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'Write-ObjectToSQL'. Try Get-PSRepository to see all available 
registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.0.4\PSModule.psm1:9307 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
  • The query does return one result, but the JSON object returned by the search doesn’t have the property type
  • I’ve tried adjusting the URIs to point to /v2/api - no dice
  • I’ve tried servers which have v2 api support - same errors

Note that this could be several things

  1. Lack OF OData integration in baget
  2. PowerShellGet not being compatible with v3 NuGet Feeds (though it can publish which is weird and it shows up in a generalized query.
  3. baget not publishing the type property/not handling the publishing of PS Modules correctly.
  4. type, though expected, isn’t generated by the v3 spec
  5. Operator Error - I’ve tried defining the PowerShell repository several different ways and it always throws the same, or similar errors of missing type property

Expected behavior

The module is published in the correct format and installs correctly from the baget NuGet Feed

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Is anyone using baget to serve PowerShell modules? Is there another Docker image which I should be using for this? If so, which would you recommend?

UI Screenshot

image

I’ve been bashing my head against this for two days, so thank you so much for any suggestions you might have.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
IISResetMecommented, Jul 10, 2019

I’m having similar issues with Find-Module in PowerShellGet version 1.6.7, registered repository with:

Register-PSRepository testget -SourceLocation https://[host]/v3/index.json -PublishLocation https://[host]/api/v2/package

Publish-Module works just fine, but according to the IIS logs Find-Module MyModuleName sends a GET request for:

https://[host]/v3/index.json/FindPackagesById()?id='MyModuleName'

To which the server responds with some dynamic web page:

<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="description" content="BaGet"><meta name="author" content="Loic Sharma"><title>BaGet</title><link href="/static/css/main.9bf9dd7b.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script type="text/javascript" src="/static/js/main.860c9147.js"></script></body></html>
1reaction
OCram85commented, Apr 11, 2019
  • Just installed release version 0.1.175-prerelease.

Environment

  • Windows 10 Client
  • PowerShell 5.1 Desktop
  • PackageManagement Modules:
    • PowerShellGet 2.0.4
    • PackageManagement 1.3.1
  • Published a PowerShell module and still run into this: Imgur

Is there a different Source Location than given in the PowerShell setup instructions?

Register-PSRepository -Name "BaGet" -SourceLocation "http://<host-fqdn>/v3/index.json" -PublishLocation "http://<host-fqdn>/api/v2/package" -InstallationPolicy "Trusted"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Powershell won't install almost any module using ...
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.0.4\PSModule.psm1: ... Trying to install a PowerShell module behind a proxy?
Read more >
Cannot install powershell modules - Microsoft Q&A
PS C:\WINDOWS\system32> Install-Module -Name AzureAD PackageManagement\Install-Package : Unable to find module providers (PowerShellGet).
Read more >
Install-Module (PowerShellGet) - PowerShell
Install -Module downloads and installs the newest version of PowerShellGet into the current user's directory, $HOME\Documents\PowerShell\Modules . Example 6: ...
Read more >
Unable to download from URI – powershell install module
PowerShell Install-Module Error: Unable to Download from URI ... module (EXOv2), you may see the following PowershellGet and NuGet provider ...
Read more >
The 'install-module' command was found in the ... - Evotec
Home PowerShell Install-module : The 'install-module' command was found in the module 'PowerShellGet', but the module could not be loaded.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found