Search code examples
amazon-web-servicesnpmaws-lambdasam

How to get latest version of SAM-CLI on windows


I have latest node installed:

node --version
v14.15.0

I installed sam-cli from https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-windows.html

Then i ran following command npm install -g aws-sam-local

When i run:

sam --version 

I get following:

A newer version of the AWS SAM CLI is available!
Your version:   0.2.11
Latest version: 1.9.0
See https://github.com/awslabs/aws-sam-local for upgrade instructions

I am attempting to invoke aws lambda function locally like following:

sam local invoke

I get following output:

2020/11/11 22:24:18 Successfully parsed template.yml
2020/11/11 22:24:18 Connected to Docker 1.40
2020/11/11 22:24:18 Could not initiate nodejs14.15 runtime: unsupported runtime

What am i missing?


Solution

  • Problem was i somehow installed 2 versions of sam-cli. I just deleted both from C:\Program Files\Amazon and reinstalled using msi from https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-windows.html.

    After this i was getting command not found when running

    sam --version
    

    Finally found that

    sam.cmd --version 
    

    worked as expected.