通过 powershell 在 Windows 10 上安装时出现 Argo CD CLI 错误
Argo CD CLI error when installing on Windows 10 via powershell
我正在尝试按照网站上的命令替换版本,在我的 windows 10 PC 上安装 ArgoCD CLI,但收到以下错误。它似乎不喜欢 + 运算符?有人可以帮忙吗?
PS C:\Users\dell.docker> $url = "https://github.com/argoproj/argo-cd/releases/download/" + v2.2.3 + "/argocd-windows-amd64.exe"
At line:1 char:66
+ ... = "https://github.com/argoproj/argo-cd/releases/download/" + v2.2.3 ...
+ ~
You must provide a value expression following the '+' operator.
At line:1 char:67
+ ... ps://github.com/argoproj/argo-cd/releases/download/" + v2.2.3 + "/arg ...
+ ~~~~~~
Unexpected token 'v2.2.3' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedValueExpression
您必须引用版本号:
$url = "https://github.com/argoproj/argo-cd/releases/download/" + 'v2.2.3' + "/argocd-windows-amd64.exe"
当然,您也可以仅使用 one 引号字符串开头,由于使用 expandable (double-quoted) string ("..."
) - 如果版本号通过 变量:
提供
$version = 'v2.2.3' # Quoting is required here too - '...' is a verbatim string
$url = "https://github.com/argoproj/argo-cd/releases/download/$version/argocd-windows-amd64.exe"
It does not seem to like the + operator
问题不在于 +
运算符,而是使用您打算成为的 string 文字 - v2.2.3
- 不加引号.
在 PowerShell(表达式模式)中,运算符在 表达式 的上下文中运行,并且在表达式中,所有字符串文字都需要引号。
相比之下,只有当您将 arguments 传递给 commands(参数模式)时,您才可以传递字符串值(没有空格和其他元字符) 不加引号:
Write-Output v2.2.3 # OK - quoting optional
有关这两种基本解析模式的详细信息,请参阅概念性 about_Parsing 帮助主题。
我正在尝试按照网站上的命令替换版本,在我的 windows 10 PC 上安装 ArgoCD CLI,但收到以下错误。它似乎不喜欢 + 运算符?有人可以帮忙吗?
PS C:\Users\dell.docker> $url = "https://github.com/argoproj/argo-cd/releases/download/" + v2.2.3 + "/argocd-windows-amd64.exe"
At line:1 char:66
+ ... = "https://github.com/argoproj/argo-cd/releases/download/" + v2.2.3 ...
+ ~
You must provide a value expression following the '+' operator.
At line:1 char:67
+ ... ps://github.com/argoproj/argo-cd/releases/download/" + v2.2.3 + "/arg ...
+ ~~~~~~
Unexpected token 'v2.2.3' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedValueExpression
您必须引用版本号:
$url = "https://github.com/argoproj/argo-cd/releases/download/" + 'v2.2.3' + "/argocd-windows-amd64.exe"
当然,您也可以仅使用 one 引号字符串开头,由于使用 expandable (double-quoted) string ("..."
) - 如果版本号通过 变量:
$version = 'v2.2.3' # Quoting is required here too - '...' is a verbatim string
$url = "https://github.com/argoproj/argo-cd/releases/download/$version/argocd-windows-amd64.exe"
It does not seem to like the + operator
问题不在于 +
运算符,而是使用您打算成为的 string 文字 - v2.2.3
- 不加引号.
在 PowerShell(表达式模式)中,运算符在 表达式 的上下文中运行,并且在表达式中,所有字符串文字都需要引号。
相比之下,只有当您将 arguments 传递给 commands(参数模式)时,您才可以传递字符串值(没有空格和其他元字符) 不加引号:
Write-Output v2.2.3 # OK - quoting optional
有关这两种基本解析模式的详细信息,请参阅概念性 about_Parsing 帮助主题。