The term 'Install-Module' is not recognized as the name of a cmdlet

℡╲_俬逩灬. 提交于 2019-12-04 02:44:55

问题


I am following the directions to install poshgit. In doing so I ran:

Install-Module posh-git

Error:

The term 'Install-Module' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and t ry again.

I ran $PSVersionTable.PSVersion: result = 2.0.-1.-1

Is Install-Module an addon? How can I run this command?


回答1:


Another GUI based option to fix this error is to download the PackageManagement PowerShell Modules (msi installer) from Microsoft website and install the modules.

Once this is installed you will not get "'Install-Module' is not recognized as the name of a cmdlet" error.




回答2:


Do you have PsGet installed? That's the Installing via PsGet section.

The section after that is the manual instructions:

  1. Verify you have PowerShell 2.0 or better with $PSVersionTable.PSVersion

  2. Verify execution of scripts is allowed with Get-ExecutionPolicy (should be RemoteSigned or Unrestricted). If scripts are not enabled, run PowerShell as Administrator and call Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm.

  3. Verify that git can be run from PowerShell. If the command is not found, you will need to add a git alias or add %ProgramFiles(x86)%\Git\cmd (or %ProgramFiles%\Git\cmd if you're still on 32-bit) to your PATH environment variable.

  4. Clone the posh-git repository to your local machine.

  5. From the posh-git repository directory, run .\install.ps1.

  6. Enjoy!



来源:https://stackoverflow.com/questions/29828756/the-term-install-module-is-not-recognized-as-the-name-of-a-cmdlet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!