首页 > 解决方案 > 安装模块 PowerShellGet 时发出警告

问题描述

在安装 PowerShellGet 时,我执行以下操作:

Install-PackageProvider Nuget –force –verbose

然后我退出,尝试运行以下命令:

Install-Module –Name PowerShellGet –Force –Verbose

当我这样做时,我收到错误: 安装模块出错

当我尝试安装其他模块(如 MSOnline、Azure 等)时也会发生此错误。我有最新版本的 Powershell 以及必要的模块。感觉是PowershellGet文件的原因。

有没有办法解决这个问题?

标签: powershell

解决方案


You need to register the PowerShell repository before installing PowerShellGet. Try this

Register-PSRepository -Name “PSGallery” -SourceLocation “https://www.powershellgallery.com/api/v2/" -InstallationPolicy Trusted

推荐阅读