为什么PowerShell 5重命名后仍在寻找旧的PowerShell Gallery路径?

问题描述 投票:2回答:1

我有一个本地PowerShell画廊,我将其重命名为JnPSGallery。我注销了旧路径\\\Ryzen\G$\JnPowerShellGallery,然后注册了新路径\\\Ryzen\G$\JnPSGallery,但是当我使用Update-Module命令时,PowerShell 5仍在尝试寻找旧路径。我什至尝试注销所有存储库,然后在Update-Module中键入以查看会发生什么。

我收到错误信息'PackageManagement \ Install-Package:无法找到存储库\\\Ryzen\G$\JnPowerShellGallery。使用Get-PSRepository查看所有可用的存储库。即使所有存储库都未注册,它仍在寻找旧的PowerShell Gallery路径。

注册新的JnPSGallery路径后,更新模块。https://i.imgur.com/SOgk3zn.png

删除所有已注册存储库后的更新模块。https://i.imgur.com/ZFTi0ut.png

如何阻止PowerShell 5尝试使用旧路径\\\Ryzen\G$\JnPowerShellGallery

powershell
1个回答
0
投票

感谢您的帮助Joel&adrian.anderson。我已解决问题!

http://slack.poshcode.org/ powershell-help频道上的乔尔建议我安装的某些模块可能仍在引用我的旧PSGallery路径。他是对的!

[今天早上醒来时,我打开PowerShell 5,键入Get-InstalledModule,然后在我前面的两个模块仍在引用我的旧PSGallery路径。我卸载了那些模块,错误消失了。

我本来以为问题出在PowerShellGet模块上。我现在觉得很傻。

Get-InstalledModule显示了两个引用旧画廊的模块。https://i.imgur.com/TWFtWcP.png

感谢Joel,它使我免于重新安装Windows。

© www.soinside.com 2019 - 2024. All rights reserved.