Azure / autorest

OpenAPI (f.k.a Swagger) Specification code generator. Supports C#, PowerShell, Go, Java, Node.js, TypeScript, Python
MIT License
4.6k stars 736 forks source link

Unable to start AutoRest Core #4618

Closed harryli0108 closed 2 years ago

harryli0108 commented 2 years ago

Hi! I'm running into an issue saying "Unable to start AutoRest Core" every time when I'm trying to either start autorest. Currently, the .autorest folder is empty, and I also got an error saying "Failed to install extension autorest.csharp" when I try --force.

timotheeguerin commented 2 years ago

Hi @harryli0108 could you share more information? The full logs with --debug --verbose

ghost commented 2 years ago

Hi, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

harryli0108 commented 2 years ago

Here's the output in powershell: npm WARN config global --global, --local are deprecated. Use --location=global instead. AutoRest code generation utility [version: 2.0.4413; node: v16.16.0] (C) 2018 Microsoft Corporation. https://aka.ms/autorest

There is a new version of AutoRest available (3.6.2).

You can install the newer version with with npm install -g autorest@latest

Failure: Error: Unable to start AutoRest Core from C:\Users\harrli.autorest@microsoft.azure_autorest-core@2.0.4421[node_modules@microsoft.azure](mailto:node_modules@microsoft.azure)\autorest-core Error: Unable to start AutoRest Core from C:\Users\harrli.autorest@microsoft.azure_autorest-core@2.0.4421[node_modules@microsoft.azure](mailto:node_modules@microsoft.azure)\autorest-core at main (C:\Users\harrli\AppData\Roaming\npm\node_modules\autorest\dist\app.js:233:19) npm notice npm notice New minor version of npm available! 8.11.0 -> 8.18.0 npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.18.0 npm notice Run npm install -g npm@8.18.0 to update! npm notice

And here's the error log from npm: 0 verbose cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js 1 info using npm@8.11.0 2 info using node@v16.16.0 3 timing npm:load:whichnode Completed in 0ms 4 timing config:load:defaults Completed in 1ms 5 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 1ms 6 timing config:load:builtin Completed in 3ms 7 timing config:load:cli Completed in 1ms 8 timing config:load:env Completed in 0ms 9 timing config:load:project Completed in 3ms 10 timing config:load:file:C:\Users\harrli.npmrc Completed in 0ms 11 timing config:load:user Completed in 0ms 12 timing config:load:file:C:\Users\harrli\AppData\Roaming\npm\etc\npmrc Completed in 1ms 13 timing config:load:global Completed in 1ms 14 timing config:load:validate Completed in 0ms 15 timing config:load:credentials Completed in 0ms 16 timing config:load:setEnvs Completed in 1ms 17 timing config:load Completed in 10ms 18 timing npm:load:configload Completed in 10ms 19 timing npm:load:mkdirpcache Completed in 1ms 20 timing npm:load:mkdirplogs Completed in 0ms 21 verbose title npm exec autorest@previous --input-file=swagger.v1.json --add-credentials --client-side-validation=false --csharp --base-folder=test/V1/ --namespace=test.V1 --public-clients=true --clear-output-folder --force 22 verbose argv "exec" "--" "autorest@previous" "--input-file=/src/Api/swagger.v1.json" "--add-credentials" "--client-side-validation=false" "--csharp" "--base-folder=test/V1/" "--namespace=test.V1" "--public-clients=true" "--clear-output-folder" "--force" 23 timing npm:load:setTitle Completed in 2ms 24 timing config:load:flatten Completed in 2ms 25 timing npm:load:display Completed in 3ms 26 verbose logfile logs-max:10 dir:C:\Users\harrli\AppData\Local\npm-cache_logs 27 verbose logfile C:\Users\harrli\AppData\Local\npm-cache_logs\2022-08-25T23_44_41_961Z-debug-0.log 28 timing npm:load:logFile Completed in 4ms 29 timing npm:load:timers Completed in 0ms 30 timing npm:load:configScope Completed in 0ms 31 timing npm:load Completed in 20ms 32 silly logfile start cleaning logs, removing 2 files 33 timing arborist:ctor Completed in 0ms 34 silly logfile done cleaning log files 35 http fetch GET 200 https://registry.npmjs.org/autorest 125ms (cache revalidated) 36 timing arborist:ctor Completed in 1ms 37 timing arborist:ctor Completed in 0ms 38 http fetch GET 200 https://registry.npmjs.org/npm 393ms (cache miss) 39 timing command:exec Completed in 4151ms 40 notice 40 notice New �[33mminor�[39m version of npm available! �[31m8.11.0�[39m -> �[32m8.18.0�[39m 40 notice Changelog: �[36mhttps://github.com/npm/cli/releases/tag/v8.18.0�[39m 40 notice Run �[32mnpm install -g npm@8.18.0�[39m to update! 40 notice 41 verbose exit 1 42 timing npm Completed in 4303ms 43 verbose code 1

harryli0108 commented 2 years ago

When I tried to install csharp extension manually by doing npm install @microsoft.azure/autorest.csharp, it successfully installed but failed to run when running npx autorest command. Here's the error message I got:

(C) 2018 Microsoft Corporation. https://aka.ms/autorest Loading AutoRest core 'C:\Users\harrli\node_modules\@microsoft.azure\autorest-core\dist' (2.0.4421) Installing AutoRest extension '@microsoft.azure/autorest.csharp' (~2.3.79) 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: Failed to install package 'https://registry.npmjs.org/@microsoft.azure/autorest.csharp/-/autorest.csharp-2.3.82.tgz' -- Error: Process Failed.Error: Failed to install package 'https://registry.npmjs.org/@microsoft.azure/autorest.csharp/-/autorest.csharp-2.3.82.tgz' -- Error: Process Failed. at install (/node_modules/@microsoft.azure/extension/dist/main.js:303:15) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async ExtensionManager.installPackage (/node_modules/@microsoft.azure/extension/dist/main.js:472:13) at async Configuration.CreateView (C:\Users\harrli\node_modules\@microsoft.azure\autorest-core\dist\lib\configuration.js:685:51) at async AutoRest.RegenerateView (C:\Users\harrli\node_modules\@microsoft.azure\autorest-core\dist\lib\autorest-core.js:55:29) at async currentMain (C:\Users\harrli\node_modules\@microsoft.azure\autorest-core\dist\app.js:303:20) at async mainImpl (C:\Users\harrli\node_modules\@microsoft.azure\autorest-core\dist\app.js:506:20) at async main (C:\Users\harrli\node_modules\@microsoft.azure\autorest-core\dist\app.js:530:20)

timotheeguerin commented 2 years ago

Autorest v2 has an issue if you have an existing package.json and/or node_modules folder in the user directory or above. Did you have that in C:\Users\harrli\.autorest or above? If so can you try deleting and retuning autorest.

The problem is that nom install ran inside of C:\Users\harrli\.autorest lookup above for an existing package.json and install the package in the wrong place.

ghost commented 2 years ago

Hi, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!