Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autorest fails to resolve csharp extension package. Looks at wrong path #5068

Open
rsquarev opened this issue Feb 1, 2025 · 0 comments
Open
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@rsquarev
Copy link

rsquarev commented Feb 1, 2025

Our enterprise setup artifactory and we must use that in order to get npm packages. npmrc has registry defined and I was able to install autorest package. I struggled to get core and csharp for sometime using autorest --help --debug. Finally I added @autorest/core and @autorest/csharp packages using npm install. It did install those extension packages in global npm cache. With that atleast I can see output for autorest --help cli command. I thought it is all good now.

But when I run autorest for client generation, I stuck with an error saying unable to resolve csharp package, though it is in npm\node_modules. If you notice the log and stack trace, there is path issue. autorest is expecting nodemodules folder but node_modules exists.

I am not sure if it is a bug with package or something wrong with our enterprise setup.

I appreciate your help in showing me a direction to resolve this

input yaml file gen.yaml

input-file: test.yaml 
csharp: true
output-folder: restclient\
namespace: Me.Tests.AutoRest

cli command

autorest gen.yaml

output

AutoRest code generation utility [cli version: 3.7.1; node: v18.20.4]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
info    |    Loading AutoRest core      'C:\Users\u787338\AppData\Roaming\npm\node_modules\@autorest\core\dist' (3.10.3)
error   |   Error: Unable to resolve package '@autorest/csharp@latest'.
error   | stack: Error: Unable to resolve package '@autorest/csharp@latest'.
    at fetchPackageMetadata (C:\Users\u787338\AppData\Roaming\npm\nodemodules\@autorest\core\dist\src_lib_autorest-corets.js:17675:15)
    at runNextTicks (node:internal/process/task_queues:60:5)
    at processImmediate (node:internal/timers:447:9)
    at ExtensionManager.findPackage (C:\Users\u787338\AppData\Roaming\npm\nodemodules\@autorest\core\dist\src_lib_autorest-corets.js:17759:24)
    at ExtensionManager.getInstalledExtension (C:\Users\u787338\AppData\Roaming\npm\nodemodules\@autorest\core\dist\src_lib_autorest-corets.js:17791:25)
    at ConfigurationLoader.resolveExtension (C:\Users\u787338\AppData\Roaming\npm\nodemodules\@autorest\core\dist\src_lib_autorest-corets.js:13147:40)
    at ConfigurationLoader.load (C:\Users\u787338\AppData\Roaming\npm\nodemodules\@autorest\core\dist\src_lib_autorest-corets.js:13044:43)
    at AutorestContextLoader.createView (C:\Users\u787338\AppData\Roaming\npm\nodemodules\@autorest\core\dist\src_lib_autorest-corets.js:439:40)
    at AutoRest.RegenerateView (C:\Users\u787338\AppData\Roaming\npm\nodemodules\@autorest\core\dist\src_lib_autorest-corets.js:82:30)
    at currentMain (C:\Users\u787338\AppData\Roaming\npm\node_modules\@autorest\core\dist\app.js:120:21)
    at main (C:\Users\u787338\AppData\Roaming\npm\node_modules\@autorest\core\dist\app.js:289:16)
error   | Autorest completed with an error. If you think the error message is unclear, or is a bug, please declare an issues at https://github.com/Azure/autorest/issues with the error message you are seeing.
fatal   | Failed to install extension '@autorest/csharp' (latest)
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

1 participant