Win10笔记本电脑服务了几年。
我被困在这上面已经有几天了。
我尝试了以下命令:
Install-Module –Name PowerShellGet –Force -AllowClobber引发此错误的:
WARNING: The version '1.4.7' of module 'PackageManagement'
is currently in use. Retry the operation after closing the applications.我可以在任务管理器中看到,没有其他正在运行的powershell会话。
我可以退出所有会话,并从普通cmd运行以下操作:
powershell -NoProfile -Command "Install-Module -Name PowerShellGet -Force -AllowClobber"和我得到了同样的错误.
好的,我退出所有powershell实例(如taskmgr的Details选项卡中所示)并执行以下操作:
powershell -NoProfile -Command "Uninstall-Module PowerShellGet"
powershell -NoProfile -Command "Install-Module -Name PowerShellGet -Force -AllowClobber"和我得到了相同的错误。
因此,我再次进行卸载(它运行时没有消息或错误)。我拿出大枪..。powershell.exe没有运行,我导航到:
C:\Users\$user\Documents\WindowsPowerShell\Modules\PackageManagement\1.4.7我删除了1.4.7目录。
上面的命令以相同的行为和相同的错误运行。
我该怎么通过这件事?
附加背景:
PS C:\WINDOWS\system32> Get-Module -ListAvailable PowerShellGet,PackageManagement
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.4.7 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Binary 1.0.0.1 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script 2.2.5 PowerShellGet {Find-Command, Find-DSCResource, Find-Module, Find-RoleCap...
Script 1.0.0.1 PowerShellGet {Install-Module, Find-Module, Save-Module, Update-Module...}
PS C:\WINDOWS\system32> Get-Module -ListAvailable PowerShellGet,PackageManagement | % path
C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.4.7\PackageManagement.psd1
C:\Program Files\WindowsPowerShell\Modules\PackageManagement\1.0.0.1\PackageManagement.psd1
C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PowerShellGet.psd1
C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PowerShellGet.psd1也尝试过
限制当前用户的范围:
PS C:\WINDOWS\system32> Install-Module -Name PowerShellGet -Force -Scope CurrentUser
WARNING: The version '1.4.7' of module 'PackageManagement' is currently in use. Retry the operation after closing the
applications.
PS C:\WINDOWS\system32> exit
# OK, check taskmgr that all powershell.exe have exited, and run the below
C:\WINDOWS\system32>powershell -command "Install-Module -Name PowerShellGet -Force -Scope CurrentUser"
WARNING: The version '1.4.7' of module 'PackageManagement' is currently in use. Retry the operation after closing the
applications.溶液
我没有准确地跟踪这一步,但下面的评论之一最终找到了解决问题的途径。
其中一个技巧是查看进程列表,并确保在进行更新之前,所有vscode和其他powershell加载过程都已终止。
抱歉,我不能记录解决问题的确切步骤。(我在为这个干杯。)
发布于 2021-04-14 20:39:23
我能够通过在admin PowerShell中运行下面的命令来修复这个问题:
Update-Module -Name PowerShellGet -RequiredVersion 2.2.5希望这能帮到别人!
发布于 2022-01-22 19:53:22
我没有代表发表评论,但詹姆斯格雷厄姆的帖子建议使用更新模块对我也有效。差不多一年后,同样的问题,同样的版本号。不过,我刚刚检查了一下,现在有了一个3.0.12测试版,需要下面的代码:
Install-Module -Name PowerShellGet -AllowPrerelease -Force我试了一段时间想弄清楚语法的高亮显示,但没有结果。
https://stackoverflow.com/questions/66305351
复制相似问题