Skip to content

[BUG] Template installation fails with "Cannot find module 'package.json'" error #1983

Closed

Description

@shivansh-source

Describe the bug.

The AsyncAPI Generator is unable to install templates automatically, failing with a Cannot find module 'package.json' error. This affects all installation methods (Chocolatey, npm, development environment) and all platforms (Windows, Linux).

Expected behavior

Cross-Platform Impact
Confirmed Failing On:

Windows 10 (Chocolatey installation)
Linux (development environment)
All npm installations
Development environment

Screenshots

This issue was initially reported in the CLI repository: asyncapi/cli/#1743

How to Reproduce

: Using npm-published templates
bashasyncapi generate fromTemplate asyncapi.yaml @asyncapi/nodejs-template
Expected: Template should be automatically downloaded and installed
Actual: Fails with "Installation failed" error

🖥️ Device Information [optional]

No response

👀 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 ?

Yes I am willing to submit a PR!

Activity

  1. added
    bug
    on Feb 12, 2026
  2. shivansh-source commented on Feb 12, 2026

    @shivansh-source
    Author

    @Adi-204 @Shurtu-gal can i start to work with this ?

  3. shivansh-source commented on Feb 12, 2026

    @shivansh-source
    Author

    Update: Bug Appears to be Fixed ✅

    I've completed testing and can confirm the original bug no longer exists in the current version.

    Test Results

    Environment:

    • Generator Version: 3.1.2
    • Node Version: v24.13.1
    • OS: Linux (WSL/Ubuntu)
    • Installation: npm

    Test Performed:

    1. Uninstalled all templates: npm uninstall -g @asyncapi/nodejs-template @asyncapi/html-template
    2. Verified templates were removed
    3. Ran: asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template -o ./docs

    Result: ✅ SUCCESS

    • Template downloaded automatically (no manual pre-installation required)
    • No "Cannot find module 'package.json'" error
    • Files generated successfully

    Additional Finding

    The @asyncapi/nodejs-template showed a version compatibility issue with generator v3.1.2:

  4. shivansh-source commented on Feb 12, 2026

    @shivansh-source
    Author

    However, this is a different issue (template version compatibility), not the original installation bug.

    Conclusion

    The original template installation bug appears to have been resolved. The generator now correctly:

    • Downloads templates from npm registry
    • Resolves package.json files
    • Installs and uses templates without manual pre-installation

    Recommendation: This issue can likely be closed, or maintainers can confirm if additional testing is needed on other platforms (Windows with Chocolatey, etc.).

  5. shivansh-source commented on Feb 12, 2026

    @shivansh-source
    Author
    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions