Aws is not recognized as an internal or external command, operable program or batch file

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Pick a username Email AddressPassword

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

FreskimAliu opened this issue

Jun 14, 2021

· 3 comments

Assignees

Comments

Confirm by changing [ ] to [x] below:

  • I've gone though the User Guide and the API reference
  • I've searched for previous similar issues and didn't find any solution

Issue is about usage on:

  • Service API : I want to do X using Y service, what should I do?
  • CLI : passing arguments or cli configurations.
  • Other/Not sure.

Platform/OS/Hardware/Device
What are you running the cli on?
Windows 10
Describe the question
When I try to run command that have alias functions, I'm getting this:

Aws is not recognized as an internal or external command, operable program or batch file

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

Logs/output
Get full traceback and error logs by adding --debug to the command.

Aws is not recognized as an internal or external command, operable program or batch file

Hi @FreskimAliu,

Sorry to hear you're having trouble. The AWS aliases that are using shell function definitions only work on a bash-like shell, not on a Windows command line. Aliases that are using sub-commands for AWS should function properly (like running-instances).

You can read more about the prerequisites and usage here, and specifically about bash-scripting aliases in the section titled "Creating a bash scripting alias":

https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-alias.html

I installed WSL on my Windows machine and now it works fine. Thanks for explanation @kdaily.

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

2 participants

Fix - 'amplify' is not recognized as an internal or external command #

To solve the error "'amplify' is not recognized as an internal or external command, operable program or batch file", install the @aws-amplify/cli package globally by running npm install -g @aws-amplify/cli and make sure your PATH environment variable is set up correctly.

Open your terminal and install @aws-amplify/cli globally by running the following command.

Copied!

npm install -g @aws-amplify/cli

If you still get the error, try to install the package with the --unsafe-perm flag.

Copied!

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

If the command above fails with permissions error, open your shell as an administrator or prefix the command with sudo.

Copied!

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

The --unsafe-perm flag forces npm to download the @aws-amplify binary.

If the "'amplify' is not recognized as an internal or external command" error is not resolved, try restarting your terminal.

If that didn't help, run the following command:

Copied!

npm config get prefix

The command will show you the path where npm puts your globally installed packages. The global packages will be in the bin directory at the specified path.

Look at the PATH environment variable on your operating system and add the path that the npm config get prefix command outputs, if it's not already there.

If you add the output from the command to your PATH environment variable, you have to restart any open command prompts before it takes effect.

On Windows, the output of the npm config get prefix command will look something like: C:\Users\Your_User_Name\AppData\Roaming\npm.

To update the PATH on a Windows machine, you have to:

  1. Open the start search and type in env and then click "Edit the system environment variables"
  2. Then click "Environment Variables"
  3. Edit the Path variable and add the output you got from the npm config get prefix command.

The path should look like C:\Users\Your_User_Name\AppData\Roaming\npm (make sure to replace the Your_User_name placeholder with your actual username).

If you add the output from the command to your PATH environment variable, you have to restart any open command prompts before it takes effect.

If you get the error "amplify cannot be loaded because running scripts is disabled on this system", open your PowerShell as an administrator and set its execution policy with the Set-ExecutionPolicy command.

Copied!

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Make sure to open your PowerShell as an administrator before you run the Set-ExecutionPolicy command.

This effectively removes the execution policy of Restricted, which doesn't allow us to load configuration files or run scripts. The Restricted execution policy is the default for Windows client computers.

If you are on macOS, you can update your path with the following command:

Copied!

# make sure path matches with npm config get prefix export PATH=/usr/local/share/npm/bin:$PATH

If you are on Linux, you can add the output from the npm config get prefix command to your .bashrc file.

Copied!

# 👇️ make sure to update the path with the output # from the command export PATH="/usr/local/share/npm/bin:$PATH"

If you add the output from the command to your PATH environment variable, you have to restart any open command prompts before it takes effect.

If that doesn't help try to reinstall Node.js on your machine and then install @aws-amplify/cli globally by running npm install -g @aws-amplify/cli.

During the installation you might get a prompt for whether you want to automatically update the PATH environment variable on your system, make sure to tick the option.

Copied!

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

If the global installation of @aws-amplify/cli fails, you might have to open your shell as an administrator or run the command prefixed with sudo.

Copied!

# 👇️ if you got permissions error sudo npm install -g @aws-amplify/cli --unsafe-perm=true

Alternatively, you can see how you can fix the permissions error on this page in the official npm docs.

Is not recognized as an internal or external command operable program or batch file aws?

'aws' is not recognized as an internal or external command, operable program or batch file. This issue occurs when the path of the CLI installed path is not given along with aws command. 1) For Solution, enter CR with a Workaround if a direct Solution is not available.

Why AWS CLI is not opening?

If the aws command cannot be found after first installing or updating the AWS CLI, it might not have been fully installed. Try reinstalling by following the steps for your platform in Installing or updating the latest version of the AWS CLI.

How do I add aws command line to Windows Terminal?

Install and update the AWS CLI version 1 using the MSI installer.
Run the downloaded MSI installer or the setup file..
Follow the on-screen instructions. ... .
To confirm the installation, use the aws --version command at a command prompt (open the Start menu and search for cmd to start a command prompt)..

How do I open aws command line in Windows?

AWS CLI setup: Download and installation on Windows.
Download the appropriate MSI installer. Download the AWS CLI MSI installer for Windows (64-bit) Download the AWS CLI MSI installer for Windows (32-bit) Note. ... .
Run the downloaded MSI installer..
Follow the instructions that appear..