Unable to Install-PSResource a user-published package using Linux
See original GitHub issuePrerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
Steps to reproduce
The steps I took:
- Register GitHub Packages as trusted PSResourceRepository
- Publish User-Created module to GitHub Packages with Publish-PSResource
- Install module from GitHub Packages with Install-PSResource
In code:
Register-PSResourceRepository -Name GitHub -URI https://nuget.pkg.github.com/REPO_OWNER/index.json -Trusted
Publish-PSResource -Path Path/To/ExampleModule.psd1 -ApiKey VALID_GITHUB_PAT -Repository GitHub
Install-PSResource -Name "examplemodule" -Repository GitHub -Credential $validPSCredential
Notes: For some reason the name in GitHub packages goes into all-lowercase, so I reflected that in the Install-PSResource
command. The Credential I used was with REPO_OWNER as the username and the VALID_GITHUB_PAT converted to a SecureString as the password.
Expected behavior
Successful Installation regardless of operation system.
Actual behavior
# Windows
PS> Register-PSResourceRepository -Name GitHub -URI https://nuget.pkg.github.com/beau-witter/index.json -Trusted
PS> Install-PSResource -Name 'networkanalyzer' -Repository GitHub -Credential $validPSCredential
PS> Get-PSResource -Name 'networkanalyzer'
Name Version Prerelease Repository Description
---- ------- ---------- ---------- -----------
networkanalyzer 0.0.3.0 NetworkAnalyzer-repository Powershell Module that can be used to detect internet speeds, reset net adapter, and more.
# Linux
PS> Register-PSResourceRepository -Name GitHub -URI https://nuget.pkg.github.com/beau-witter/index.json -Trusted
PS> Install-PSResource -Name 'networkanalyzer' -Repository GitHub -Credential $validPSCredential
Install-PSResource: Unable to successfully install package 'networkanalyzer': 'Could not find file '/tmp/d6c43241-bd32-4cff-b46b-33c4c897d117/networkanalyzer/0.0.3/networkanalyzer.ps1'.'
Error details
PS> Get-Error
Exception :
Type : System.Management.Automation.PSInvalidOperationException
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : Unable to successfully install package 'networkanalyzer': 'Could not find file '/tmp/c9c642a3-1a9
7-4e14-801f-aa9cbdee6b37/networkanalyzer/0.0.3/networkanalyzer.ps1'.'
HResult : -2146233087
CategoryInfo : InvalidOperation: (:) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : InvalidOperation
Message : Unable to successfully install package 'networkanalyzer': 'Could not find file '/tmp/c9c642a3-1a97
-4e14-801f-aa9cbdee6b37/networkanalyzer/0.0.3/networkanalyzer.ps1'.'
InnerException :
Type : System.IO.FileNotFoundException
Message : Could not find file '/tmp/c9c642a3-1a97-4e14-801f-aa9cbdee6b37/networkanalyzer/0.0.3/networkanalyz
er.ps1'.
FileName : /tmp/c9c642a3-1a97-4e14-801f-aa9cbdee6b37/networkanalyzer/0.0.3/networkanalyzer.ps1
TargetSite :
Name : ThrowExceptionForIoErrno
DeclaringType : Interop, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7b
ea7798e
MemberType : Method
Module : System.Private.CoreLib.dll
Source : System.Private.CoreLib
HResult : -2147024894
StackTrace :
at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirError)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare shar
e, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePer
missions, Func`4 createOpenException)
at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, F
ileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
at System.IO.File.ReadAllLines(String path, Encoding encoding)
at Microsoft.PowerShell.PowerShellGet.UtilClasses.PSScriptFileInfo.TryParseScriptFileContents(String scriptFileInfoP
ath, List`1& psScriptInfoCommentContent, List`1& helpInfoCommentContent, List`1& requiresCommentContent, String[]& rema
iningFileContent, ErrorRecord& error)
at Microsoft.PowerShell.PowerShellGet.UtilClasses.PSScriptFileInfo.TryTestPSScriptFile(String scriptFileInfoPath, PS
ScriptFileInfo& parsedScript, ErrorRecord[]& errors, String[]& verboseMsgs)
at Microsoft.PowerShell.PowerShellGet.Cmdlets.InstallHelper.InstallPackage(List`1 pkgsToInstall, String repoName, St
ring repoUri, PSCredentialInfo repoCredentialInfo, PSCredential credential, Boolean isLocalRepo, ScopeType scope)
HResult : -2146233079
TargetObject : Microsoft.PowerShell.PowerShellGet.Cmdlets.InstallPSResource
CategoryInfo : InvalidOperation: (Microsoft.PowerShel…s.InstallPSResource:InstallPSResource) [Install-PSResour
ce], PSInvalidOperationException
FullyQualifiedErrorId : InstallPackageFailed,Microsoft.PowerShell.PowerShellGet.Cmdlets.InstallPSResource
InvocationInfo :
MyCommand : Install-PSResource
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 9
Line : Install-PSResource -Name $existingPackage.Name -Repository $existingPackage.Repository -Version
$existingPackage.Version.ToString() -Credential $credential
PositionMessage : At line:1 char:1
+ Install-PSResource -Name $existingPackage.Name -Repository $existingP …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Install-PSResource
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
Environment data
# Windows
PS> Get-Module PowerShellGet; $PSVersionTable | Format-Table
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.2.5 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Find-RoleCapability…}
Binary 3.0.19 beta19 PowerShellGet {Find-PSResource, Get-PSResource, Get-PSResourceRepository, Get-PSScriptFileInfo…}
Name Value
---- -----
PSVersion 7.3.2
PSEdition Core
GitCommitId 7.3.2
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
# Linux
PS> Get-Module PowerShellGet; $PSVersionTable | Format-Table
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.2.5 PowerShellGet {Find-Command, Find-DscResource, Find-Module, Fin…
Binary 3.0.19 beta19 PowerShellGet {Find-PSResource, Get-PSResource, Get-PSResourceR…
Name Value
---- -----
PSVersion 7.3.3
PSEdition Core
GitCommitId 7.3.3
OS Linux 4.4.0-19041-Microsoft #2311-Microsoft Tue Nov 08 17:09:00 PST 2022
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Issue Analytics
- State:
- Created 7 months ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is a duplicate of https://github.com/PowerShell/PowerShellGet/issues/608 to support GitHub packages.
This issue has been marked as duplicate and has not had any activity for 1 day. It will be closed for housekeeping purposes.