Skip to content
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

Install Amplify CLI on Windows Github Actions Fails: The term 'install.cmd' is not recognized as a name of a cmdlet #13664

Open
2 tasks done
dkliss opened this issue Mar 21, 2024 · 6 comments
Labels
documentation Add or update documentation installation Issues tied to installation of the CLI

Comments

@dkliss
Copy link

dkliss commented Mar 21, 2024

How did you install the Amplify CLI?

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

If applicable, what version of Node.js are you using?

No response

Amplify CLI Version

12.10.1

What operating system are you using?

runs-on: windows-latest

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

"No manual changes made"

Describe the bug

I run below workflow but the curl command fails with error. Is there something else to be done aport from running curl for windows?

"The term 'install.cmd' is not recognized as a name of a cmdlet, function, script file, or executable program. | Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

build_windows:
  name: Build Flutter (windows)
  needs: [flutter_test]
  runs-on: windows-latest
  steps:
    - uses: actions/checkout@v4
    - uses: subosito/flutter-action@v2
      with:
        channel: "stable"
    - name: Install AWS CLI
      run: |
        curl -sL https://aws-amplify.github.io/amplify-cli/install-win -o install.cmd && install.cmd
    - name: Install Amplify CLI
      run: |
        npm install -g @aws-amplify/cli --unsafe-perm=true
    - run: amplify --version

Expected behavior

I expect below to work for Windows host in GitHib Actions.

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

Reproduction steps

Run above workflow with curl.

Project Identifier

No response

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@dkliss dkliss added the pending-triage Issue is pending triage label Mar 21, 2024
@ykethan
Copy link
Member

ykethan commented Mar 22, 2024

Hey @dkliss, noticed you were able to setup a Github Actions on #13661, would you require any assistance on this?

@ykethan ykethan added the pending-response Issue is pending response from the issue author label Mar 22, 2024
@dkliss
Copy link
Author

dkliss commented Mar 23, 2024

Hey @dkliss, noticed you were able to setup a Github Actions on #13661, would you require any assistance on this?

Hi @ykethan, thanks for your response.

This issue is different and is on installing awscli on windows host github action. I did resolved this using different way (as shown in workflow below) to install. However, this curl command "curl -sL https://aws-amplify.github.io/amplify-cli/install-win -o install.cmd && install.cmd", which is in amplify documentation to install awscli on windows always fails with error I mentioned in issue above.

No issues if we need to close this as I have resolved but if there is attention needed to the curl -sL https://aws-amplify.github.io/amplify-cli/install-win -o install.cmd && install.cmd", this can be kept opened.

    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v4
      - uses: subosito/flutter-action@v2
        with:
          channel: "stable"
      - name: Download AWS CLI Installer
        run: |
          # Download the AWS CLI installer
          Invoke-WebRequest -Uri 'https://awscli.amazonaws.com/AWSCLIV2.msi' -OutFile 'AWSCLIV2.msi'
      - name: Install AWS CLI
        run: |
          # Install the AWS CLI silently
          Start-Process msiexec.exe -Wait -ArgumentList '/i', 'AWSCLIV2.msi', '/quiet'
      - name: Verify AWS CLI Installation
        run: |
          # Verify the installation by checking the version
          aws --version
      - name: Install Amplify CLI
        run: |
          npm install -g @aws-amplify/cli
      - run: amplify --version

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Mar 23, 2024
@ykethan
Copy link
Member

ykethan commented Mar 26, 2024

@dkliss thank you for the information. I was able to reproduce this on a Github action. I was able to get this working by using the following

- name: Install AWS CLI
        run: |
          curl -sL https://aws-amplify.github.io/amplify-cli/install-win -o install.cmd && ./install.cmd

Marking this as documentation improvements.

@ykethan ykethan added documentation Add or update documentation installation Issues tied to installation of the CLI and removed pending-triage Issue is pending triage labels Mar 26, 2024
@dkliss
Copy link
Author

dkliss commented Mar 27, 2024

Thank you @ykethan. I have verified this and the the updated command works as epected.

 build_windows:
    name: Build Flutter (windows)
    needs: [flutter_test]
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v4
      - uses: subosito/flutter-action@v2
        with:
          channel: "stable"
      - name: Install AWS CLI
        run: |
            curl -sL https://aws-amplify.github.io/amplify-cli/install-win -o install.cmd && ./install.cmd
      - name: Verify AWS CLI Installation
        run: |
          # Verify the installation by checking the version
          aws --version
      - name: Install Amplify CLI
        run: |
          npm install -g @aws-amplify/cli
      - run: amplify --version

@ykethan
Copy link
Member

ykethan commented Mar 27, 2024

@dkliss glad to hear, just a quick observation on your script it appears the Amplify CLI is being installed twice, with once with curl and once with npm.

@dkliss
Copy link
Author

dkliss commented Mar 27, 2024

@dkliss glad to hear, just a quick observation on your script it appears the Amplify CLI is being installed twice, with once with curl and once with npm.

Hi @ykethan Yes, I just noticed and I changed the script to below but it failed with error shown. The original script above works. Not sure if this is something to do with "-g" or global flag in "npm install -g @aws-amplify/cli". Also, will the curl command install both awscli as well as aws-amplify cli? I needed to run commands such as "aws configure set" following this script and hence I need both aws and aws-amplify cli.

 build_windows:
    name: Build Flutter (windows)
    needs: [flutter_test]
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v4
      - uses: subosito/flutter-action@v2
        with:
          channel: "stable"
      - name: Install AWS CLI
        run: |
            curl -sL https://aws-amplify.github.io/amplify-cli/install-win -o install.cmd && ./install.cmd
      - name: Verify AWS CLI Installation
        run: |
          # Verify the installation by checking the version
          aws --version
      - run: amplify --version

Failed as below:


Line |
   2 |  amplify --version
     |  ~~~~~~~
     | The term 'amplify' is not recognized as a name of a cmdlet, function, script file, or executable program. Check
     | the spelling of the name, or if a path was included, verify that the path is correct and try again.
Error: Process completed with exit code 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Add or update documentation installation Issues tied to installation of the CLI
Projects
None yet
Development

No branches or pull requests

2 participants