Warm tip: This article is reproduced from serverfault.com, please click

amazon web services-使用sudo找不到命令'sam'

(amazon web services - command 'sam' not found using sudo)

发布于 2019-05-07 11:06:42

我已经安装了山姆使用以下

https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-linux.html

我可以跟随

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
Questioner
Dushyant Joshi
Viewed
0
Dominique 2019-05-07 21:18:11

你可以尝试以下操作:
在普通终端(普通用户)中:

which sam

sam假设可以找到安装位置/somewhere/bin/sam

然后:尝试:

sudo /somewhere/bin/sam build