简体   繁体   English

PowerShell x64 无法识别 Install-Module 无法识别为 cmdlet 的名称

[英]PowerShell x64 does not recognize Install-Module is not recognized as the name of the cmdlet

I know Install-Module is a PowerShell 5 or above feature.我知道 Install-Module 是 PowerShell 5 或更高版本的功能。

I am running Windows 10 pro version 20H2 with OS-build:19042.746我正在使用 OS-build:19042.746 运行 Windows 10 专业版 20H2

I checked the version of PS using $PSVersionTable .我使用$PSVersionTable检查了 PS 的版本。 The output is provided below. output 如下所示。

PS C:\Windows\system32> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.610
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.610
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Another thing that I found out while searching for the fix is that, The PowerShell x86 version is working fine and there are no issues.我在寻找修复程序时发现的另一件事是, PowerShell x86版本工作正常,没有任何问题。

I can't run the Window Management Framework 5.1 because it was meant for other systems to upgrade the PowerShell.我无法运行 Window 管理框架 5.1,因为它是为了让其他系统升级 PowerShell。 However, I am running the latest version.但是,我正在运行最新版本。

Is there any fix for 64bit? 64位有什么解决办法吗?

A workaround I found is copying the Modules folder in Program Files (x86)\WindowsPowershell to Program Files\WindowsPowershell (64 bit folder).我发现的一种解决方法是将Program Files (x86)\WindowsPowershell中的Modules文件夹复制到Program Files\WindowsPowershell (64 位文件夹)。 Somehow the modules got deleted from the 64 bit Powershell folder.不知何故,这些模块已从 64 位 Powershell 文件夹中删除。 I cannot pinpoint the exact reason but I suspect the culprit may be the KB5001330 update.我无法确定确切原因,但我怀疑罪魁祸首可能是KB5001330更新。

Huh, I wonder if this is a bug?呵呵,不知道这是不是bug?

The PowerShell x86 version is working fine and there are no issues. PowerShell x86 版本工作正常,没有问题。

This comment doesn't make sense as Install-Module is part of the PowerShellGet module, which shouldn't care if you're running the x64 or x86 shell.此评论没有意义,因为Install-ModulePowerShellGet模块的一部分,它不应该关心您是否正在运行 x64 或 x86 shell。 Regardless, here's a few things you can try.无论如何,这里有一些你可以尝试的事情。

# check if PowerShellGet is available locally
Get-Module PowerShellGet -List

# check if PackageManagement is available locally
Get-Module PackageManagement -List
  • Have you ran Windows Update?您是否运行过 Windows 更新? If not: run it, restart, repeat until there's nothing left.如果没有:运行它,重新启动,重复直到没有任何东西。
  • .NET should have been installed with the operating system - check if it was. .NET应该已经安装了操作系统 - 检查是否是。
# Needs to be run in an Admin shell. Alternatively, us the gui in next point
Get-WindowsOptionalFeature -Online -FeatureName NetFx* | Format-Table

# if not, you can add it by going typing 'windows feature' in the start menu and going to
# 'Turn Windows feature on or off'

I don't know if it was a bug or not.我不知道这是否是一个错误。 I just reinstalled the windows and problem got fixed.我刚刚重新安装了 windows,问题得到了解决。

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

相关问题 安装模块:术语“安装模块”未被识别为 cmdlet 的名称 - Install-Module : The term 'Install-Module' is not recognized as the name of a cmdlet Install-Module:术语“ Install-Module”未被识别为cmdlet的名称(PS版本5.x !!) - Install-Module : The term 'Install-Module' is not recognized as the name of a cmdlet (PS ver. 5.x !!) 术语“安装模块”不被识别为cmdlet的名称 - The term 'Install-Module' is not recognized as the name of a cmdlet 安装模块不可用 - 无法识别为 cmdlet 的名称 - Install-Module not available - not recognized as a name of a cmdlet 运行“Install-Module”时出错:无法识别为 cmdlet、function、脚本文件或可运行程序的名称 - Error when running 'Install-Module': is not recognized as the name of a cmdlet, function, script file, or operable program 术语“安装模块”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称 - The term 'Install-Module' is not recognized as the name of a cmdlet, function, script file, or operable program 安装模块在哪里<module name>从中获取模块?</module> - Where does Install-Module <module name> fetch modules from? PowerShell 安装模块本地 vs CurrentUser - PowerShell Install-Module Local vs CurrentUser 带有 iex 安装模块的 Powershell 错误失败 - Powershell error with iex install-module failed 找不到TFS Powershell安装模块 - TFS Powershell Install-Module not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM