Azure / azure-resource-manager-schemas

Schemas used to author and validate Resource Manager Templates. These schemas power the intellisense and syntax completion in our ARM Tools VSCode extension, as well as the Export Template API
MIT License
603 stars 514 forks source link

Error on running `generate-single` locally #3058

Closed sebader closed 2 months ago

sebader commented 2 months ago

I just cloned this repo and trying to run generate-single locally (on MacOS).

I successfully ran npm install before and also npm run list-basepaths --specs-dir "/Users/sebastianbader/repos/Azure/azure-rest-api-specs-pr/"

sebastianbader@seb-macbook generator % npm run generate-single -- --specs-dir "/Users/sebastianbader/repos/Azure/azure-rest-api-specs-pr/" --base-path cloudhealth/resource-manager

> template-schema-generator@1.0.0 generate-single
> ts-node cmd/generatesingle --specs-dir /Users/sebastianbader/repos/Azure/azure-rest-api-specs-pr/ --base-path cloudhealth/resource-manager

Using autogenlist config:
{
  "basePath": "cloudhealth/resource-manager",
  "namespace": "Microsoft.CloudHealth"
}
[/Users/sebastianbader/repos/Azure/azure-resource-manager-schemas/generator] executing: /Users/sebastianbader/repos/Azure/azure-resource-manager-schemas/generator/node_modules/.bin/autorest --use=@autorest/modelerfour --use=/Users/sebastianbader/repos/Azure/azure-resource-manager-schemas/bicep-types-az/src/autorest.bicep --bicep --output-folder=/var/folders/mr/ksh73q650xs9ft2c89lqqgvh0000gn/T/4g8tep8mwiw --multiapi --title=none --skip-semantics-validation --arm-schema=true /Users/sebastianbader/repos/Azure/azure-rest-api-specs-pr/specification/cloudhealth/resource-manager/readme.md
AutoRest code generation utility [cli version: 3.6.3; node: v18.18.2]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest

There is a new version of AutoRest available (3.7.1).
 > You can install the newer version with with npm install -g autorest@latest

info    |    Loading AutoRest core      '/Users/sebastianbader/.autorest/@autorestcore@3.10.2/nodemodules/@autorest/core/dist' (3.10.2)
info    |    Loading local AutoRest extension '@autorest/bicep' (/Users/sebastianbader/repos/Azure/azure-resource-manager-schemas/bicep-types-az/src/autorest.bicep)
info    |    Loading AutoRest extension '@autorest/modelerfour' (*->4.27.0)
info    | Processing batch task - {"tag":"microsoft.cloudhealth-2023-10-01-preview"} .
info    |    Loading local AutoRest extension '@autorest/bicep' (/Users/sebastianbader/repos/Azure/azure-resource-manager-schemas/bicep-types-az/src/autorest.bicep)
info    |    Loading AutoRest extension '@autorest/modelerfour' (*->4.27.0)
node:internal/modules/cjs/loader:1080
  throw err;
  ^

Error: Cannot find module '/Users/sebastianbader/repos/Azure/azure-resource-manager-schemas/bicep-types-az/src/autorest.bicep/dist/src/main.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v18.18.2
fatal   | Process() cancelled due to failure 
error   | Batch/Error | Failure during batch task - {"tag":"microsoft.cloudhealth-2023-10-01-preview"}  -- Error: [Exception] AutoRest extension '@autorest/bicep' terminated.
error   | [Exception] AutoRest extension '@autorest/bicep' terminated.
error   |   Error: [Exception] AutoRest extension '@autorest/bicep' terminated.
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.
Error: Exited with code 1
    at /Users/sebastianbader/repos/Azure/azure-resource-manager-schemas/generator/node_modules/async/dist/async.js:176:65
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

any ideas @anthony-c-martin ?

anthony-c-martin commented 2 months ago

I've submitted https://github.com/Azure/azure-resource-manager-schemas/pull/3061 with some updated instructions. I made a major change to the way we generate schemas, and forgot to update the instructions.