12

I have installed 'amplify-cli'. When I type 'amplify configure', I get the error message:

'amplify is not recognized as an internal or external command, operable program or batch file'.

jkeys
  • 3,803
  • 11
  • 39
  • 63
Kebasita
  • 181
  • 2
  • 2
  • 9
  • Some additional info would be appreciated, just so others finding this question can make use of it. Did you encounter any error while running `npm install -g @aws-amplify/cli`? What platform this your this on? – Milan Oct 25 '19 at 11:57
  • Yes, I encountered error while installing cordova using the android platform. It was resolved when I used 'npm install -g @aws-amplify/cli --unsafe-perm=true'. – Kebasita Oct 26 '19 at 00:07

8 Answers8

16

Please share your platform. Are you developing on Linux, Windows (Powershell), or Linux on Windows (WSL/Ubuntu)?

Did you install the CLI globally?

Try this:

npm install -g @aws-amplify/cli

And see if that works. If the global install fails, you can try running this per an Amplify developer:

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

Edit: since you're on Windows, it's possible the CLI wasn't added to your $PATH variable. You can fix it by seeing this Github issue.

jkeys
  • 3,803
  • 11
  • 39
  • 63
2

To solve this, simply edit a PATH key under system Environment Variables and add a new path pointing to amplify:

C:\Users\{UserName}\AppData\Roaming\npm\amplify.cmd

If you have globally installed amplify/cli then you should find two files named amplify and amplify.cmd in the above mentioned npm directory.

1

Under same circumstances I run all the suggested solutions on Windows 10 machine (64 bit). None of them seemed to do the trick. I got a more specific error:

..... cannot be loaded because running scripts is disabled on this system .... + CategoryInfo : SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess

The issue appears due to Windows PowerShell execution policies. Eventually, I managed to amend it by applying the following:

C:\Windows\System32>powershell Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
CyberMessiah
  • 1,084
  • 11
  • 14
0

Above solutions didn't work for me, I had to run this instead of 'amplify init':

C:\Users{UserName}\AppData\Roaming\npm\amplify init

behold
  • 538
  • 5
  • 19
0

I had the same issue and my problem was because I was trying to install it using

yarn global add @aws-amplify/cli

Apparently, it doesn't work when it is installed with yarn it has to be npm. It's funny because there are no errors shown. There might be a fix to it maybe someone can look into that.

Artan M.
  • 817
  • 1
  • 11
  • 16
0

If you are on windows platform avoid using the global(-g) flag from your npm command. Install Amplify CLI with below npm command.

npm install @aws-amplify/cli

It worked for me.

thinkerBOB
  • 128
  • 2
  • 11
0

Error:

amplify : The term 'amplify' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. le program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

  • amplify init
    • CategoryInfo : ObjectNotFound: (amplify:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

Try this for windows:

Step 1:

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

Step 2:

npm config get prefix

Step 3:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

you must run this code on PowerShell not a cmd.

0

I had the same issue For Windows, try the below command to install Amplify CLI

$ curl -sL https://aws-amplify.github.io/amplify-cli/install-win -o install.cmd && install.cmd

$ amplify configure

for more info on installation follow the link https://docs.amplify.aws/cli/start/install/