5ecured
5ecured

Reputation: 201

Setting PATH environment variable in Macbook M1 for AWS amplify error

I have just installed amplify by doing npm install -g @aws-amplify/cli

Now I am trying to amplify configure but it is giving me an error: zsh: permission denied: amplify

So I used sudo in front of it, entered my password, but this time it says amplify: command not found

I have a feeling it is likely to do with my PATH environment variable. But I am worried because I am not too familiar with this stuff. All I know is I can see that some of my global packages are installed in usr -> local -> lib -> node_modules and some are installed in opt -> homebrew -> bin

I tried putting this command in my zshrc: export PATH="$PATH:/opt/homebrew/bin/" and it does not work. I realized that my /opt/homebrew/bin is actually located in macintoshHD/opt/homebrew/bin. This means I have to go up twice, because $PATH is my userName. so I tried putting export PATH=$PATH:/../../opt/homebrew/bin/ but it still does not work.....

Could someone please help me with this? Just give me the commands for setting my PATH env variable to be correct, and I will do it. Thanks in advance!

Upvotes: 0

Views: 390

Answers (1)

Med Agou
Med Agou

Reputation: 1281

My guess is your first install despite it's a global install finished with some errors.

try installing it using sudo :

sudo npm install -g @aws-amplify/cli

and change owner of the local directory :

sudo "cd ~youruser && chown youruser ~/.amplify"

Upvotes: 0

Related Questions