5

I am trying the petshop client generation example on github and autorest just exits without creating anything or throwing any errors. Autorest behaves like I did not pass any arguments. Attached is a screenshot of my powershell execution.

enter image description here

busbina
  • 549
  • 1
  • 7
  • 19
  • 1
    I'm having the same problem. I got it to work by manually downloading the AutoRest nuget package and running the same command with the executable from the package. – P.N. Nov 03 '17 at 10:02
  • I reformatted the drive and reinstalled everything and that fixed the issue. I have no idea what was causing it though. I opened I ticket on GitHub for it, but I closed the issue once I was no longer able to reproduce it. https://github.com/Azure/autorest/issues/2686 You should open a new one and reference mine, so they know multiple people are seeing this. – busbina Nov 03 '17 at 17:21

3 Answers3

2

Try executing your same command but add --verbose at the end to tell autorest to print out any errors. I was experiencing the same problem and what worked for me was creating the following readme.yml file and simply running the command

autorest readme.yml

With those two things (readme.yml and the command) I was able to generate the code in csharp without any issues.

Image of Readme.yml for csharp code generation:

enter image description here

  • there is also the `--debug` option that actually shows what it does. For me it says _emitting file foo_, but doesn't – Markus Nov 26 '19 at 11:59
2

For me what finally worked was:

  1. Install the latest Node from https://nodejs.org/
  2. Go to C:\Users\%userprofile%\AppData\Roaming\npm and delete the 2 autorest files there if you have them.
  3. Open a Command Prompt (type cmd in the address of any Windows folder)
  4. In the Command Prompt type this command:

    npm cache clean -f

  5. Now, also in the same Command Prompt, type this command:

    npm install autorest -g

You should now be able to generate your client.

Serj Sagan
  • 28,927
  • 17
  • 154
  • 183
1

This answer on GitHub repo of Autorest, suggest that you execute

autorest --reset

after updating. It removes older plugins of Autorest. I had the same problem (without updating Autorest) and it has solved after that.

sgy
  • 2,922
  • 2
  • 35
  • 42