autorest icon indicating copy to clipboard operation
autorest copied to clipboard

Failed to install Autorest extension...

Open srininz77 opened this issue 9 years ago • 20 comments

When I try to generate csharp proxy I get the following error:

Installing AutoRest extension '@microsoft.azure/autorest.csharp' (~2.1.0) Unable to install/use dotnet framework. (node:20816) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5):

srininz77 avatar Nov 29 '17 04:11 srininz77

@srininz77

Can I get you to upgrade to the preview autorest:

npm install -g autorest@preview
autorest --reset 

And try again?

fearthecowboy avatar Nov 29 '17 16:11 fearthecowboy

When I run autorest --reset I get the following error

No configuration found at 'file:///C:/Users/abc/.autorest/'.

srininz77 avatar Nov 29 '17 19:11 srininz77

Ah, that's a mostly harmless message; it's just mentioning that it doesn't have a file to process.

You should be fine now.

fearthecowboy avatar Nov 29 '17 20:11 fearthecowboy

C:\temp\autorestTest>autorest readme.md --input-file=test.json --csharp AutoRest code generation utility [version: 2.0.4210] (C) 2017 Microsoft Corporation. https://aka.ms/autorest Installing AutoRest extension '@microsoft.azure/autorest.csharp' (~2.2.45) Unable to install/use dotnet framework. Failed to install or start extension '@microsoft.azure/autorest.csharp' (~2.2.45 ) Error: Package '@microsoft.azure/autorest.csharp' - '2.2.45' failed to install : [email protected] postinstall: node -e "/*PostInstall: Installs platform-spec ific .NET framework */try{require('./dist/app.js')}catch(e){}" Exit status 1

srininz77 avatar Nov 29 '17 21:11 srininz77

O_o

What version of node are you using? I'd think it'd complain earlier about that.

ok, let's try this:

set an environment variable DEBUG to 1

ie:

REM set the debug environment variable to 1 (cmd) 
set DEBUG=1

# set the debug environment variable to 1 (powershell) 
$env:DEBUG="1"

And run it again...

fearthecowboy avatar Nov 29 '17 21:11 fearthecowboy

I'm using node version 8.9.1

Log file attached yarn-error.log

srininz77 avatar Nov 29 '17 21:11 srininz77

Let's just rule out a couple more things:

REM Manually remove the .net and .autorest folders
cmd /c rmdir /s /q c:\users\abc\.net
cmd /c rmdir /s /q c:\users\abc\.autoerst 

(assuming your username is abc )

Hmm... your log file has:

Error: self signed certificate in certificate chain
      at TLSSocket.<anonymous> (_tls_wrap.js:1103:38)
      at emitNone (events.js:106:13)
      at TLSSocket.emit (events.js:208:7)
      at TLSSocket._finishInit (_tls_wrap.js:637:8)
      at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:467:38)

O_o -- that's kindof weird.

Are you behind some kind of firewall? proxy?

fearthecowboy avatar Nov 29 '17 22:11 fearthecowboy

Yes, I'm behind corporate firewall

srininz77 avatar Nov 30 '17 00:11 srininz77

I noticed a workaround for this issue posted at https://github.com/Azure/autorest/issues/2071

"I've obtained the binaries for dotnet-win7-x64.1.0.3.zip and autorest-1.0.1020170412-2300-nightly.zip. Is there a way to tell autorest to use these binaries and not try and download them? If so, this might be a workaround.

Edit 1: you don't need to tell autorest to not try and download these binaries. It detects that they've been downloaded. This works: Download the dotnet framework link and unpack it into C:\Users\USERNAME.autorest\frameworks Download the autorest link and unpack it into C:\Users\USERNAME.autorest\plugins\autorest (ie, C:\Users\USERNAME.autorest\plugins\autorest\1.0.1-20170323-2300-nightly )"

Where do I get the latest binaries and does this workaround still valid for .net core 2?

srininz77 avatar Nov 30 '17 20:11 srininz77

For .NET Core 2.0, we actually created npm packages for them.

you can install it with npm install -g dotnet-2.0.0-win -- that will install the .net framework binaries

fearthecowboy avatar Nov 30 '17 21:11 fearthecowboy

C:\temp\autorestTest>autorest readme.md --input-file:test.json --csharp AutoRest code generation utility [version: 2.0.4210] (C) 2017 Microsoft Corporation. https://aka.ms/autorest Loading AutoRest extension '@microsoft.azure/autorest.csharp' (~2.2.45) Installing AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.38) Failed to install or start extension '@microsoft.azure/autorest.modeler' (2.3.38 ) Error: Package '@microsoft.azure/autorest.modeler' - '2.3.38' failed to instal l: request to https://registry.npmjs.org/@microsoft.azure/autorest.modeler/-/auto rest.modeler-2.3.38.tgz failed, reason: getaddrinfo ENOTFOUND branch branch:80

srininz77 avatar Dec 01 '17 00:12 srininz77

I'm going to prep a all-in-one package for you this morning.

fearthecowboy avatar Dec 01 '17 16:12 fearthecowboy

Ok, I've published an all-in-one portable build for Windows:

https://github.com/Azure/autorest/releases/tag/v2.0.4215

You can grab the zip file and unpack it.

fearthecowboy avatar Dec 01 '17 16:12 fearthecowboy

c:\temp\autorestTest>"C:\Users\abc\Downloads\Autorest.Windows.Portable.2.0 .4215\autorest.cmd" readme.md --input-file="test.json" --csharp AutoRest code generation utility [version: 2.0.4215] (C) 2017 Microsoft Corporation. https://aka.ms/autorest Loading local AutoRest extension '@microsoft.azure/autorest.csharp' (C:\Users \abc\Downloads\Autorest.Windows.Portable.2.0.4215\node_modules@microsoft. azure\autorest.csharp) Loading local AutoRest extension '@microsoft.azure/autorest.modeler' (C:\User s\abc\Downloads\Autorest.Windows.Portable.2.0.4215\node_modules@microsoft .azure\autorest.modeler) Process() Cancelled due to exception : Plugin 'imodeler1' not found. Error: Plugin 'imodeler1' not found.

srininz77 avatar Dec 03 '17 20:12 srininz77

Totally my fault. I rebuilt another, this should function at least.

https://github.com/Azure/autorest/releases/tag/v2.0.4216

fearthecowboy avatar Dec 04 '17 15:12 fearthecowboy

c:\temp\autorestTest>"C:\Users\abc\Downloads\Autorest.Windows.Portable.2.0 .4216-preview\autorest.cmd" readme.md --input-file="test.json" --csharp AutoRest code generation utility [version: 2.0.4215] (C) 2017 Microsoft Corporation. https://aka.ms/autorest Loading local AutoRest extension '@microsoft.azure/autorest.csharp' (C:\Users \abc\Downloads\Autorest.Windows.Portable.2.0.4216-preview\node_modules@mi crosoft.azure\autorest.csharp) Loading local AutoRest extension '@microsoft.azure/autorest.modeler' (C:\User s\abc\Downloads\Autorest.Windows.Portable.2.0.4216-preview\node_modules@m icrosoft.azure\autorest.modeler) FATAL: System.ArgumentNullException: Value cannot be null. Parameter name: source at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable1 source, Func2 selector) at AutoRest.Modeler.Model.RequestBody.AsParameters() in C:\Users\ci\AppData\L ocal\Temp\PUBLISHa9fks\40_20171201T233754\autorest.modeler\src\Model\RequestBody .cs:line 38 at AutoRest.Modeler.Model.Operation.get_Parameters() in C:\Users\ci\AppData\L ocal\Temp\PUBLISHa9fks\40_20171201T233754\autorest.modeler\src\Model\Operation.c s:line 88 at AutoRest.Modeler.OperationBuilder.BuildMethodParameters(Method method) in C:\Users\ci\AppData\Local\Temp\PUBLISHa9fks\40_20171201T233754\autorest.modeler
src\OperationBuilder.cs:line 238 at AutoRest.Modeler.OperationBuilder.BuildMethod(HttpMethod httpMethod, Strin g url, String methodName, String methodGroup) in C:\Users\ci\AppData\Local\Temp
PUBLISHa9fks\40_20171201T233754\autorest.modeler\src\OperationBuilder.cs:line 86

at AutoRest.Modeler.SwaggerModeler.BuildMethod(HttpMethod httpMethod, String url, String name, Operation operation) in C:\Users\ci\AppData\Local\Temp\PUBLISH a9fks\40_20171201T233754\autorest.modeler\src\SwaggerModeler.cs:line 331 at AutoRest.Modeler.SwaggerModeler.Build(ServiceDefinition serviceDefinition) in C:\Users\ci\AppData\Local\Temp\PUBLISHa9fks\40_20171201T233754\autorest.mode ler\src\SwaggerModeler.cs:line 105 at AutoRest.Modeler.Program.d__2.MoveNext() in C:\Users\ci\A ppData\Local\Temp\PUBLISHa9fks\40_20171201T233754\autorest.modeler\src\Program.c s:line 60 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNot ification(Task task) at NewPlugin.d__15.MoveNext() FATAL: csharp/imodeler1 - FAILED FATAL: Error: Plugin imodeler1 reported failure. Process() Cancelled due to exception : Plugin imodeler1 reported failure. Error: Plugin imodeler1 reported failure.

srininz77 avatar Dec 04 '17 20:12 srininz77

Well, we're past the point of it failing to install!

You're getting an error based on the content now.

What's in your readme.md and test.json file?

fearthecowboy avatar Dec 04 '17 21:12 fearthecowboy

Yes you are correct. There was something wrong with my swagger. I tried with couple of my other services and it works. Thank you very much for all your help.

srininz77 avatar Dec 04 '17 22:12 srininz77

@srininz77

Can I get you to upgrade to the preview autorest:

npm install -g autorest@preview
autorest --reset 

And try again?

This works. However, before that, remove autorest first.

npm remove -g autorest

After that you can re-install autorest using the command above

npm install -g autorest@preview
autorest --reset 

After that it works.

imkheong avatar Sep 17 '18 09:09 imkheong

Ok, I've published an all-in-one portable build for Windows:

https://github.com/Azure/autorest/releases/tag/v2.0.4215

You can grab the zip file and unpack it.

Hi Has this been updated recently I am behind a corporate proxy and am having a nightmare trying to download and get autorest install and up and running. I did have it running on a laptop but I circumvented the proxy by downloading whilst on a wifi connection not behind a proxy. Unfortunately I cannot do this from my new desktop which sits behind a corporate proxy. Any advice on why I cannot pull down the the dependancies via npm?

Here is the log of my attempts.. PS C:> autorest --reset AutoRest code generation utility [version: 2.0.4289; node: v11.6.0] (C) 2018 Microsoft Corporation. https://aka.ms/autorest C:\Users\[email protected][email protected]\autorest-core -> C:\Users\[email protected][email protected]\[email protected]\autorest-core\dist\app.js C:\Users\[email protected][email protected]\autorest-language-service -> C:\Users\[email protected][email protected]\[email protected]\autorest-core\dist\language-service\language-service.js Loading AutoRest core 'C:\Users\[email protected][email protected]\[email protected]\autorest-core\dist' (2.0.4289) PS C:> npm install -g dotnet-2.0.0-win C:\Users\user1\AppData\Roaming\npm\dotnet-run -> C:\Users\user1\AppData\Roaming\npm\node_modules\dotnet-2.0.0-win\main.js C:\Users\user1\AppData\Roaming\npm\dotnet -> C:\Users\user1\AppData\Roaming\npm\node_modules\dotnet-2.0.0-win\main.js C:\Users\user1\AppData\Roaming\npm\dn -> C:\Users\user1\AppData\Roaming\npm\node_modules\dotnet-2.0.0-win\dotnet.exe

  • [email protected] updated 1 package in 2.636s PS C:> autorest --input-file=petstore.yaml --csharp --output-folder=CSharp_PetStore --namespace=PetStore AutoRest code generation utility [version: 2.0.4289; node: v11.6.0] (C) 2018 Microsoft Corporation. https://aka.ms/autorest Loading AutoRest core 'C:\Users\[email protected][email protected]\[email protected]\autorest-core\dist' (2.0.4289) Installing AutoRest extension '@microsoft.azure/autorest.csharp' (~2.3.79) Unable to install/use dotnet framework. Failed to install or start extension '@microsoft.azure/autorest.csharp' (~2.3.79) Error: Package '@microsoft.azure/autorest.csharp' - '2.3.82' failed to install: [email protected] postinstall: node -e "/*PostInstall: Installs platform-specific .NET framework */try{require('./dist/app.js')}catch(e){}" Exit status 1 PS C:> npm install -g dotnet-2.0.0-win C:\Users\user1\AppData\Roaming\npm\dotnet-run -> C:\Users\user1\AppData\Roaming\npm\node_modules\dotnet-2.0.0-win\main.js C:\Users\user1\AppData\Roaming\npm\dotnet -> C:\Users\user1\AppData\Roaming\npm\node_modules\dotnet-2.0.0-win\main.js C:\Users\user1\AppData\Roaming\npm\dn -> C:\Users\user1\AppData\Roaming\npm\node_modules\dotnet-2.0.0-win\dotnet.exe
  • [email protected] updated 1 package in 2.086s

madheaduk avatar Dec 27 '18 12:12 madheaduk