Description
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)
Activity