PowerShell / PowerShellGetv2

PowerShellGet is the Package Manager for PowerShell
https://www.PowerShellGallery.com
MIT License
430 stars 138 forks source link

Register-PackageSource: The property 'Name' cannot be found on this object. Verify that the property exists. #638

Open gkvappium opened 3 years ago

gkvappium commented 3 years ago

Steps to reproduce

Check if PowerShell repository exists on local machine

if ($null -eq (Get-PSRepository | Where-Object { $_.Name -eq "TestPsModulesRepo" })) { Write-Host "Registering PowerSHellGet Repo 'TestPsModulesRepo'" Register-PackageSource -Name "TestPsModulesRepo" -Location "$FeedUrl" -ProviderName "PowerShellGet" -Force -Credential $credential -Trusted }

Expected behavior

Package source should get registered. Worked fine for me on Windows. But I hit the error only on Mac

Actual behavior

DEBUG: 00:00:00.0724656 ProviderName: PowerShellGet DEBUG: 00:00:00.0736562 INVOKING PowerShell Fn Resolve-PackageSource with args that has length 0 DEBUG: 00:00:00.0746526 In PowerShellGet Provider - 'Resolve-PackageSource'. DEBUG: 00:00:00.0796019 PowerShell Script 'PSModule' Function 'Resolve-PackageSource' returns null. Register-PackageSource: The property 'Name' cannot be found on this object. Verify that the property exists.

Environment data

Name Value ---- ----- PSVersion 7.0.4 PSEdition Core GitCommitId 7.0.4
OS Darwin 19.6.0 Darwin Kernel Version 19.6.0: Mon… Platform Unix PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

Get-Module -ListAvailable PowerShellGet,PackageManagement

ModuleType Version PreRelease Name PSEdition ExportedCommands


Script 1.4.7 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…} Script 2.2.5 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability…}

Directory: /usr/local/microsoft/powershell/7/Modules

ModuleType Version PreRelease Name PSEdition ExportedCommands


Script 1.4.7 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…} Script 2.2.5 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability…}


> Get-PackageProvider -ListAvailable

Name                     Version          DynamicOptions
----                     -------          --------------
NuGet                    3.0.0.1          Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersions…
PowerShellGet            2.2.5.0          PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, AllowP…
gkvappium commented 3 years ago

@SydneyhSmith could you please take a look into this issue?

alerickson commented 3 years ago

@gkvappium are you having this issue when you use Register-PSRepository? If so can you provide the full -debug and -verbose log?

gkvappium commented 3 years ago

@alerickson ,thanks for looking into it. Please find below the full logs. Please note that the same code/commands are working on Windows. I see this problem only on Mac (URL,Repo name etc are all valid and working. I've just changed it a bit as per the privacy guidelines of the organization. Please don't mind.)

I've added the full log in gist https://gist.github.com/gkvappium/fd3449863e3820a510cba74e3efe9664 please do take a look

gkvappium commented 3 years ago

Any inputs on this @alerickson ?