我使用以下方法安装了sam
我可以关注
sam build
但不是
sudo sam build
which gives me => sudo: sam: command not found
此外,我发现我需要对sudo拥有sudo权限,如下所示。
sudo env "PATH=/home/linuxbrew/.linuxbrew/bin/sam" sam
以上是否正确?我尚未运行此命令,不确定是否正确。
这是我的比赛。
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
答案 0 :(得分:1)
您可以尝试以下操作:
在普通终端(普通用户)中:
which sam
这将为您提供安装sam
的位置,比方说/somewhere/bin/sam
。
然后:尝试:
sudo /somewhere/bin/sam build
答案 1 :(得分:1)
如果您遵循有关Linux + Brew + SAM安装的教程,也许您忘记了运行命令:
brew install aws-sam-cli
或者只是为命令添加别名
nano ~/.bashrc
在末尾添加行
alias sam='/home/linuxbrew/.linuxbrew/bin/sam'
保存。重新启动终端。
答案 2 :(得分:0)
遵循官方aws sam cli installation tutorial
后,运行以下命令$ brew install aws-sam-cli
==> Installing aws-sam-cli from aws/tap
==> Downloading https://github.com/aws/aws-sam-?
...
/home/linuxbrew/.linuxbrew/Cellar/aws-sam-cli/1.13.2: 3,899 files, 91MB
最后将显示它的安装位置。 对我来说,这是道路 /home/linuxbrew/.linuxbrew/Cellar/aws-sam-cli/1.13.2/libexec/bin/sam
然后建立符号链接
$ ln -s /home/linuxbrew/.linuxbrew/Cellar/aws-sam-cli/1.13.2/libexec/bin/sam /home/linuxbrew/.linuxbrew/bin/sam
现在您将可以轻松拨打sam
$ sam --version
SAM CLI, version 1.13.2