sam build error - Command 'dotnet-lambda' conflicts with an existing command from another tool

2.3k views Asked by At

I try to use 'sam build' for AWS lambda and I get error:

Build Failed Error: DotnetCliPackageBuilder:GlobalToolInstall - Error configuring the Amazon.Lambda.Tools .NET Core Global Tool: Dotnet CLI Failed: Tool 'amazon.lambda.tools' failed to update due to the following: Failed to create shell shim for tool 'amazon.lambda.tools': Command 'dotnet-lambda' conflicts with an existing command from another tool. Tool 'amazon.lambda.tools' failed to install.

If they conflict then I am eager to delete one of them. But how? I tried to update amazon.lambda.tools: dotnet tool install --global Amazon.Lambda.Tools --version 5.0.0

I get error: Failed to create shell shim for tool 'amazon.lambda.tools': Command 'dotnet-lambda' conflicts with an existing command from another tool. Tool 'amazon.lambda.tools' failed to install.

When I pass "dotnet-lambda" in CMD I get information: The application to execute does not exist: 'C:......dotnet\tools.store\amazon.lambda.tools\5.0.0\amazon.lambda.tools\5.0.0\tools\netcoreapp2.1\any\dotnet-lambda.dll'.

I reinstalled sam-cli and no effect.

It was working in C#, 'sam build' was working and then it stopped. In Git I didn't see any strange change. No idea why. Please help

2

There are 2 answers

0
Cenarius On

As it was critical for me I tried various methods to solve it. Problem is with newer amazon.lambda.tools version 5.0.0. Due to error in console, I deleted manually newer version. .dotnet\tools.store

Later I installed previous version. Downgrading to version lower solved my issue.

It's interesting topic for me, is it best practice to use 'sam build' or use other methods to build and deploy lambda?

1
Jacques Ramsden On

One thing you can try...

This happened to me. The tool was updateing/installing and failed so did not complete. When you try to list to installed tools it doesn't appear and when you try uninstall again it says it isn't installed.

So to rectify ( on windows ) go to your users folder/dotnet/tools/ and delete the 'dotnet-lambda' folder.

Try the install again and see what happens.