我想在笔记本电脑上安装posh,但是当我尝试安装w/命令"PowerShellGet\ install -Module posh-git -Scope CurrentUser -AllowPrerelease -Force“时,我会得到错误:
Install-Module : A parameter cannot be found that matches parameter name
'AllowPrerelease'.
At line:1 char:58
+ ... et\Install-Module posh-git -Scope CurrentUser -AllowPrerelease -Force
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Install-Module], Paramet
erBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Install-Module在github站点上阅读勘误表时,我看到它说我需要更新我的PowerShellGet模块w/“Install -S -S CurrentUser -Force -AllowClobber”,但这会导致错误:
PackageManagement\Install-Package : The module 'PackageManagement' cannot be
installed or updated because the authenticode signature of the file
'PackageManagement.cat' is not valid.
At C:\Program
Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809
char:21
+ ... $null = PackageManagement\Install-Package @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Microsoft.Power....InstallP
ackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : InvalidAuthenticodeSignature,ValidateAndGet-Au
thenticodeSignature,Microsoft.PowerShell.PackageManagement.Cmdlets.Insta
llPackage我在我的笔记本上搜索并尝试过从1.0.0.1版本中更新PowerShellGet的几种方法,但都没有效果。如能就如何纠正这一问题提出任何建议,将不胜感激。
发布于 2018-12-30 04:36:24
错误是特定的。您正在使用默认情况下不存在的模块参数/开关。
# get function / cmdlet details
(Get-Command -Name Install-Module).Parameters.Keys
<#
Name
InputObject
MinimumVersion
MaximumVersion
RequiredVersion
Repository
Credential
Scope
Proxy
ProxyCredential
AllowClobber
SkipPublisherCheck
Force
Verbose
Debug
ErrorAction
WarningAction
InformationAction
ErrorVariable
WarningVariable
InformationVariable
OutVariable
OutBuffer
PipelineVariable
WhatIf
Confirm
#>
Get-help -Name Install-Module -Examples
Get-help -Name Install-Module -Full
Get-help -Name Install-Module -Online根据文件:
添加到PowerShellGet和PowerShell库中的预发行版本
开发人员必须添加此选项,否则无法使用。
发布者只需添加预发布字符串(即。元数据中“2.0.0”之后的部分,版本将被视为预发布。例如:
@{
ModuleVersion = '2.0.0'
#---
PrivateData = @{
PSData = @{
Prerelease = '-alpha'
}
}
}这..。
PowerShellGet\Install-Module…也不是关于如何安装模块的常见方式(我知道)。您应该只需要安装模块cmdlet,PowerShell已经知道它来自哪个模块,并且自动加载,如果还没有加载。
试试这个..。
Find-Module -Name posh-git
Version Name Repository Description
------- ---- ---------- -----------
0.7.3 posh-git PSGallery Provides prompt ...
Find-Module -Name posh-git |
Save-Module -Path "$env:USERPROFILE\Documents\WindowsPowerShell\Modules" # -WhatIf
What if: Performing the operation "Save Package" on target "'posh-git' to location 'C:\Users\Daniel\Documents\WindowsPowerShell\Modules'".
Install-Module -Name posh-git -Scope CurrentUser -Forcehttps://stackoverflow.com/questions/53974626
复制相似问题