繁体   English   中英

如何在 Windows 10 的 PowerShell 中安装 NuGet?

[英]How to install NuGet in PowerShell on Windows 10?

在 Linux 上工作多年后,我最近获得了 Windows 10,并希望为此安装PSReadLine完成模块,我首先需要获得 VS Studio 2017 附带的NuGet 。我安装了 VS Studio 2017,然后以管理员身份打开 PowerShell 并尝试安装通过Install-Module -Name PSReadLine但是得到:

WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
WARNING: Unable to download the list of available providers. Check your internet connection.
PackageManagement\Install-PackageProvider : No match was found for the specified search criteria for the provider
'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package
has the tags.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7468 char:21
+ ...     $null = PackageManagement\Install-PackageProvider -Name $script:N ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-Pac
   kageProvider], Exception
    + FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackagePro
   vider

我试着用谷歌搜索,但到目前为止还没有“解决方案”帮助安装它。 有人可以帮我设置吗?

启用 TLS 2

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

再试一次

Install-Module MSOnline

暂无
暂无

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

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