PowerShell / PowerShell/PSScriptAnalyzer

Install-Module for PSScriptAnalyzer Occasionally failing for version 1.23.0

未关闭
#2,051 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
C#
星标
2.2k
派生
414
平均合并
13 小时 1 分钟
30 天内合并 PR
2

描述

Steps to reproduce

Run the command

Install-Module -Name PSScriptAnalyzer -RequiredVersion 1.23.0 -Force -Scope CurrentUser

Expected behavior

The PSScriptAnalyzer module should install without issue.

Actual behavior

Occasionally I'm hitting the following exception (occurs roughly 1 out of every 20 times):

WARNING: Source Location 
'https://www.powershellgallery.com/api/v2/package/PSScriptAnalyzer/1.23.0' is 
not valid.
PackageManagement\Install-Package : Package 'PSScriptAnalyzer' failed to 
download.
At C:\Program 
Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 
char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (C:\Users\Contai...tAnalyze 
   r.nupkg:String) [Install-Package], Exception
    + FullyQualifiedErrorId : PackageFailedInstallOrDownload,Microsoft.PowerSh 
   ell.PackageManagement.Cmdlets.InstallPackage

If an unexpected error was thrown then please report the full error details using e.g. $error[0] | Select-Object *

Environment data

> $PSVersionTable

TBD - need to get this info injected into our build pipeline where we're seeing this issue (not really an issue seen locally)

> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }

N/A (module hasn't been installed yet)

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,反复运行报告中的、针对 PSScriptAnalyzer 1.23.0 的 PowerShell Install-Module 命令,然后捕获缺失的 $PSVersionTable 数据和完整的错误详细信息。比较成功和失败的尝试,以确定 PowerShell Gallery 的间歇性下载失败是否可复现;在确定可靠原因并验证安装结果后即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
powershell
领域
tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。