尝试使用 aws 客户端 运行 aws-iam-authenticator 时出现安装不当警告

Improper installation warning when trying to run aws-iam-authenticator with aws client

当我尝试 运行 aws 客户端与 aws-iam-authenticator for kubernetes 时,我收到以下警告:

Warning: aws-iam-authenticator is not installed properly or is not in your path.

但是,aws-iam-authenticator 显然在我的路径中,因为我可以调用 aws-iam-authenticator help 并且它 return 的结果是:

$ aws-iam-authenticator help
A tool to authenticate to Kubernetes using AWS IAM credentials

Usage:
  heptio-authenticator-aws [command]
...

奇怪的是,which aws-iam-authenticator 没有 return 成功。所以我的 PATH.

有点奇怪

这是我的路径的一个子集:

echo $PATH
/usr/local/sbin:~/work/helpers/bin:~/.rbenv/shims:...:/usr/bin:/bin:/usr/sbin:/sbin

aws-iam-authenticator位于~/work/helpers/bin

原来这个问题是因为我在 PATH 中使用了 ~。我发现 this issue and comment 为我指明了正确的方向。将我的 PATH 更新到以下解决了我的问题:

echo $PATH
/usr/local/sbin:/$HOME/work/helpers/bin:/$HOME/.rbenv/shims:...:/usr/bin:/bin:/usr/sbin:/sbin
# Where $HOME is expanded properly

我认为在 PATH 导出中更喜欢 $HOME~ 可能是最佳实践,但我在 SO / 互联网上找不到任何东西来确认或拒绝。