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

[BUG] Generation failing with Generator Error: Installation failed #1256

Closed
2 tasks done
talglobus opened this issue Aug 18, 2024 · 7 comments
Closed
2 tasks done

[BUG] Generation failing with Generator Error: Installation failed #1256

talglobus opened this issue Aug 18, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@talglobus
Copy link

Describe the bug.

Whenever I try to generate anything, I get Generator Error: Installation failed

Here's an example I tried from the website:

asyncapi generate fromTemplate https://bit.ly/asyncapi @asyncapi/html-template -o example
┌  AsyncAPI Generator
│
◇  Generation failed
Generator Error: Installation failed

Expected behavior

Generations work correctly

Screenshots

Screenshot 2024-08-17 at 6 08 19 PM

How to Reproduce

  1. Install asyncapi with bun
  2. $ asyncapi generate fromTemplate https://bit.ly/asyncapi @asyncapi/html-template -o example
  3. Use ^+C (Mac) to quit in the middle of the generate operation
  4. Try generating anything and observe error

Note I've uninstalled and reinstalled the CLI multiple times since and found the error to be durable

🥦 Browser

Google Chrome

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

None

@talglobus talglobus added the bug Something isn't working label Aug 18, 2024
Copy link
Contributor

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@talglobus talglobus changed the title [BUG] <description> [BUG] Generation failing with Generator Error: Installation failed Aug 18, 2024
@Gmin2
Copy link
Collaborator

Gmin2 commented Aug 18, 2024

It is working fine in my machine, can you share a screen recording of it @talglobus

Copy link
Member

derberg commented Aug 19, 2024

please run generation with --debug flag and share the log

@bjhartin
Copy link

bjhartin commented Aug 29, 2024

Happens for me too, on multiple projects. Did not happen before, so I suspect this has to do with a new version of a template or something.

Debug log is:

AsyncAPI anonymously tracks command executions to improve the specification and tools, ensuring no sensitive data reaches our servers. It aids in comprehending how AsyncAPI tools are used and adopted, facilitating ongoing improvements to our specifications and tools.

To disable tracking, please run the following command:
  asyncapi config analytics --disable

Once disabled, if you want to enable tracking back again then run:
  asyncapi config analytics --enable

┌  AsyncAPI Generator
│
Template is not available locally and expected location is undefined. Known details are: undefined Error: Cannot find module '@asyncapi/html-template/package.json'
Require stack:
- /usr/local/lib/node_modules/noop.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/usr/local/lib/node_modules/@asyncapi/cli/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at resolveFileName (/usr/local/lib/node_modules/@asyncapi/cli/node_modules/resolve-from/index.js:29:39)
    at resolveFrom (/usr/local/lib/node_modules/@asyncapi/cli/node_modules/resolve-from/index.js:43:9)
    at module.exports (/usr/local/lib/node_modules/@asyncapi/cli/node_modules/resolve-from/index.js:46:47)
    at utils.getTemplateDetails (/usr/local/lib/node_modules/@asyncapi/cli/node_modules/@asyncapi/generator/lib/utils.js:196:30)
    at Generator.installTemplate (/usr/local/lib/node_modules/@asyncapi/cli/node_modules/@asyncapi/generator/lib/generator.js:561:24)
    at Generator.installAndSetupTemplate (/usr/local/lib/node_modules/@asyncapi/cli/node_modules/@asyncapi/generator/lib/generator.js:283:73)
    at Generator.generate (/usr/local/lib/node_modules/@asyncapi/cli/node_modules/@asyncapi/generator/lib/generator.js:196:16)
    at async Generator.generateFromString (/usr/local/lib/node_modules/@asyncapi/cli/node_modules/@asyncapi/generator/lib/generator.js:444:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/local/lib/node_modules/noop.js' ]
}
Template installation started because the template cannot be found on disk.
Using npm registry https://registry.npmjs.org and authorization type anonymous to handle template installation.
◇  Generation failed
Generator Error: Installation failed

@bjhartin
Copy link

bjhartin commented Aug 29, 2024

It appears this bug was introduced in 2.3.12 of the html template. I don't have this problem with versions prior to that, going back to 2.3.8. So, pinning the version in the template is a solution, e.g. @asyncapi/[email protected]. FYI @talglobus.

@bjhartin
Copy link

I should mention I'm using the docker image 'asyncapi/cli' at tag 'c03a2a76e1e4' to perform the generation via:

# Has the problem using template 2.3.12
docker run --user=root \
   --rm \
   -v "$VOLUME_MAPPING" \
   -v ${PWD}/output:"$OUTPUT_FOLDER_IN_CONTAINER" \
   asyncapi/cli generate fromTemplate \
   -o "$OUTPUT_FOLDER_IN_CONTAINER" \
   "$DOC_IN_CONTAINER" \
   @asyncapi/[email protected] \
   --force-write \
   -p sidebarOrganization=byTagsNoRoot

@derberg
Copy link
Member

derberg commented Sep 2, 2024

sorry about that, fix has been deployed -> asyncapi/html-template#672 (comment)
thanks for letting us know

@derberg derberg closed this as completed Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants