PowerShell x64 无法识别 Install-Module 未被识别为 cmdlet 的名称
PowerShell x64 does not recognize Install-Module is not recognized as the name of the cmdlet
我知道 Install-Module 是 PowerShell 5 或更高版本的功能。
我是 运行ning Windows 10 pro version 20H2 with OS-build:19042.746
我使用 $PSVersionTable
检查了 PS 的版本。下面提供了输出。
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
我在搜索修复程序时发现的另一件事是,PowerShell x86 版本工作正常并且没有问题。
我无法 运行 Window Management Framework 5.1,因为它是为其他系统升级 PowerShell 而设计的。但是,我运行正在使用最新版本。
是否有针对 64 位的修复程序?
咦,我想知道这是不是一个错误?
The PowerShell x86 version is working fine and there are no issues.
这条评论没有意义,因为 Install-Module
是 PowerShellGet
模块的一部分,它不应该关心你 运行 是 x64 还是 x86 shell。无论如何,这里有一些您可以尝试的方法。
- 你可以 manually download
PowerShellGet
(PackageManagement
是一个依赖)。相关:
# check if PowerShellGet is available locally
Get-Module PowerShellGet -List
# check if PackageManagement is available locally
Get-Module PackageManagement -List
- 你有运行Windows更新吗?如果不是:运行它,重新启动,重复直到什么都没有。
.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'
我发现的解决方法是将 Program Files (x86)\WindowsPowershell
中的 Modules
文件夹复制到 Program Files\WindowsPowershell
(64 位文件夹)。模块以某种方式从 64 位 Powershell 文件夹中删除。我无法确定确切原因,但我怀疑罪魁祸首可能是 KB5001330 更新。
不知道是不是bug。我刚刚重新安装了 windows,问题得到解决。
我知道 Install-Module 是 PowerShell 5 或更高版本的功能。
我是 运行ning Windows 10 pro version 20H2 with OS-build:19042.746
我使用 $PSVersionTable
检查了 PS 的版本。下面提供了输出。
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
我在搜索修复程序时发现的另一件事是,PowerShell x86 版本工作正常并且没有问题。
我无法 运行 Window Management Framework 5.1,因为它是为其他系统升级 PowerShell 而设计的。但是,我运行正在使用最新版本。
是否有针对 64 位的修复程序?
咦,我想知道这是不是一个错误?
The PowerShell x86 version is working fine and there are no issues.
这条评论没有意义,因为 Install-Module
是 PowerShellGet
模块的一部分,它不应该关心你 运行 是 x64 还是 x86 shell。无论如何,这里有一些您可以尝试的方法。
- 你可以 manually download
PowerShellGet
(PackageManagement
是一个依赖)。相关:
# check if PowerShellGet is available locally
Get-Module PowerShellGet -List
# check if PackageManagement is available locally
Get-Module PackageManagement -List
- 你有运行Windows更新吗?如果不是:运行它,重新启动,重复直到什么都没有。
.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'
我发现的解决方法是将 Program Files (x86)\WindowsPowershell
中的 Modules
文件夹复制到 Program Files\WindowsPowershell
(64 位文件夹)。模块以某种方式从 64 位 Powershell 文件夹中删除。我无法确定确切原因,但我怀疑罪魁祸首可能是 KB5001330 更新。
不知道是不是bug。我刚刚重新安装了 windows,问题得到解决。