aws-toolkit-vscode icon indicating copy to clipboard operation
aws-toolkit-vscode copied to clipboard

SAM CLI did not return expected data

Open davidellolio opened this issue 7 years ago • 4 comments

Describe the bug Hi, I have installed aws toolkit on visual studio code and have this error message: 2019-10-08 16:26:22 [ERROR]: SyntaxError: Unexpected token I in JSON at position 0 at JSON.parse () at SamCliInfoInvocation.convertOutput (c:\Users\ddellolio.vscode\extensions\amazonwebservices.aws-toolkit-vscode-1.1.0\out\src\shared\sam\cli\samCliInfo.js:40:25) at SamCliInfoInvocation. (c:\Users\ddellolio.vscode\extensions\amazonwebservices.aws-toolkit-vscode-1.1.0\out\src\shared\sam\cli\samCliInfo.js:26:35) at Generator.next () at fulfilled (c:\Users\ddellolio.vscode\extensions\amazonwebservices.aws-toolkit-vscode-1.1.0\out\src\shared\sam\cli\samCliInfo.js:8:58) 2019-10-08 16:26:22 [ERROR]: An error occurred while creating a new SAM Application. Check the logs for more information by running the "View AWS Toolkit Logs" command from the Command Palette. 2019-10-08 16:26:22 [ERROR]: Error: SAM CLI did not return expected data at SamCliInfoInvocation. (c:\Users\ddellolio.vscode\extensions\amazonwebservices.aws-toolkit-vscode-1.1.0\out\src\shared\sam\cli\samCliInfo.js:28:23) at Generator.next () at fulfilled (c:\Users\ddellolio.vscode\extensions\amazonwebservices.aws-toolkit-vscode-1.1.0\out\src\shared\sam\cli\samCliInfo.js:8:58)

To Reproduce Steps to reproduce the behavior:

  1. Go to VisualStudio Code
  2. On the menu bar, choose View, Command Palette.
  3. Click on "AWS: Create new SAM Application"
  4. See error

Desktop (please complete the following information):

  • OS: Windows 10 64 bit
  • Visual Studio Code Version: 1.38.1
  • AWS Toolkit for Visual Studio Code Version: 1.1.0
  • SAM Cli version: 0.22
  • Docker version: 19.03.2

Do you have any idea for this problem ?

Thank you, Davide

davidellolio avatar Oct 08 '19 14:10 davidellolio

Hi @davidellolio I have a few things for you to try out:

Is there a chance you installed the SAM CLI while you had VS Code open? You may need to close and re-open VS Code before you are able to create a new SAM Application.

Otherwise, go into your VS Code Settings (Ctrl + ,) and navigate to Extensions -> AWS Configuration. Look for the Aws › Samcli: Location field, and see if this points to the location of your SAM CLI program. If it doesn't, you can either set that value, or you can access the Command Palette (F1) and run AWS: Detect SAM CLI to see if it will detect it.

If you're unable to create a SAM Application after that, if you can open a command prompt and run sam --info I'd be interested in seeing the output.

awschristou avatar Oct 10 '19 01:10 awschristou

Hi Christou,

I have solved the problem.

The AWS Samcli was conflict with npm aws samcli. I have uninstalled with "npm uninstall -g aws-sam-local" command and now work.

Thank you so much.

davidellolio avatar Oct 10 '19 18:10 davidellolio

Thank you for the follow up!

awschristou avatar Oct 10 '19 18:10 awschristou

@awschristou your configuration suggestion worked for me.

Cool :-)

rp21buzz avatar May 25 '20 17:05 rp21buzz