繁体   English   中英

无法安装 Az 模块

[英]Unable to install Az modules

当我尝试在 Powershell 命令提示符下运行 powershell 命令时:

安装模块 Az -Force -confirm:$false -AllowClobber -Scope CurrentUser

获取以下错误:

警告:“Az”匹配来自提供者的模块“Az/4.6.0”:“PowerShellGet”,存储库“PSGallery”。 警告:“Az”匹配来自提供者的模块“Az/4.6.0”:“PowerShellGet”,存储库“PSGallery1”。 PackageManagement\\Install-Package:无法安装,多个模块与“Az”匹配。 请指定单个 -Repository。 在 C:\\Program Files\\WindowsPowerShell\\Modules\\PowerShellGet\\1.0.0.1\\PSModule.psm1:1809 字符:21

... $null = PackageManagement\\Install-Package @PSBoundParameters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ CategoryInfo : InvalidArgument: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], ExceptionfullyQualifiedErrorId : DisambiguateForInstall,Microsoft.PowerShell.PackageManagement.Cmdlets .安装包

在此处输入图片说明

由于您有两个与 Az 模块匹配的存储库,因此您需要提供使用哪个存储库来获取模块:

Install-Module Az -Force -confirm:$false -AllowClobber -Scope CurrentUser -Repository "PSGallery"

或者您可以取消注册一个重复的存储库:

Get-PsRepository

Unregister-PSRepository -Name "PSGallery1"

切换到 TLS 1.2 可能会有所帮助:为此运行以下命令并再次尝试安装 Az

PS C:\> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM