Import-Module posh-docker无法正常工作

在以pipe理员身份运行时, Import-Module posh-docker在Power Shell上不能工作

我试图为当前的PowerShell启用自动完成的命令,但得到低于错误。 executionpolicy已经设置为RemoteSigned。 我的系统中有Docker Toolbox。

 Import-Module : The specified module 'posh-docker' was not loaded because no valid module file was found directory. At line:1 char:1 + Import-Module posh-docker + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (posh-docker:String) [Import-Module], FileNotFoundExc + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand 

从你的问题,这听起来像你正在按照这个网页上的说明 ,其中读取:

您可以按如下方式安装 posh-docker PowerShell模块:

(强调我的)。 他们的措辞是不正确的; 这些步骤是在模块安装后导入的。

有关安装模块的说明,请参阅posh-docker的GitHub页面 。 您必须先遵循这些说明:

Windows 10 / Windows Server 2016

  1. 打开一个PowerShell提示
  2. 运行Install-Module -Scope CurrentUser posh-docker

较早的Windows版本

  1. 安装PackageManagement PowerShell模块预览
  2. 打开一个PowerShell提示
  3. 运行Install-Module -Scope CurrentUser posh-docker

有一点我build议,如果你使用的是早期的Windows版本:不要单独安装PackageManagement,只要安装Windows Management Framework 5.0 ,就可以获得所有的PowerShell 5。

在撰写本文时,这是最新的稳定版本,但是下个月(2017年1月),WMF 5.1应该会被发布,仅供参考。

接受的答案没有为我工作。

  1. 删除C:\Users\[user]\Documents\WindowsPowerShell\modules\posh-docker\*
  2. 从pipe理Install-Module -Scope AllUsers posh-docker运行Install-Module -Scope AllUsers posh-docker
Interesting Posts