How to fix amplify CLI error : “-bash: amplify: command not found”

Question:

I had installed amplify cli on my laptop and even though it threw errors, I had used the amplify configure command anyway and it worked. But now when I’m trying to do the same thing on a different laptop it is throwing the error “-bash: amplify: command not found”. Below is the entire error block :

amplify commands are working totally fine on the other laptop which spat the same errors as above. I had even tried installing the cli using npm install -g @aws-amplify/cli --unsafe-perm=true as suggested by a user on GitHub. If someone could help me fix this it’d be really great. TIA

Answer:

After spending a decent amount of time trying to analyse the errors, the following finally worked for me :

  1. Installed typescript
  2. Added /usr/local/bin/node and /usr/local/bin/npm to the path
  3. Made sure the admin is in charge to access the file by using the command :

    sudo chown -R ownername: /usr/local/lib/node_modules

  4. Finally installed amplify using this command :

sudo npm install -g @aws-amplify/cli --unsafe-perm=true

By following these steps, even though i’m getting errors, the amplify commands are working.

Leave a Reply