microsoft / microsoft/winget-cli

Error installing PowerShell module using PSResourceGet

Open
#3,501 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Bug PowerShell
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Brief description of your issue

Error occurs when installing the module using install-psresource.

Steps to reproduce

install-psresource Microsoft.WinGet.Client -TrustRepository

Expected behavior

Install module without error (as is the case for PowerShellGet/Install-Module).

Actual behavior

Install-PSResource: At line:69 char:21

  • NestedModules = if ($env:PROCESSOR_ARCHITECTURE -like 'x86')
  •                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

A variable that cannot be referenced in restricted language mode or a Data section is being referenced. Variables that can be referenced include the following: $PSCulture, $PSUICulture, $true, $false, $null, $PSEdition, $PSScriptRoot.

Environment
Pwsh7.4p4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce Install-PSResource Microsoft.WinGet.Client -TrustRepository under Pwsh7.4p4 and start with the module code corresponding to the reported line 69, where $env:PROCESSOR_ARCHITECTURE is referenced. Done means the module installs without the restricted-language-mode error, matching the expected PowerShellGet behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.