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] TypeError: oclifHandler is not a function in run_bin.js #1696

Closed
2 tasks done
Someshog opened this issue Mar 6, 2025 · 4 comments
Closed
2 tasks done

[BUG] TypeError: oclifHandler is not a function in run_bin.js #1696

Someshog opened this issue Mar 6, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@Someshog
Copy link

Someshog commented Mar 6, 2025

Description:

After cloning the AsyncAPI CLI repository and attempting to execute it's commands, an error (attached as a screenshot) is encountered.
However, installing AsyncAPI CLI via npm npm install -g @asyncapi/cli works fine.

Environment

  • Node.js Version: 20.13.1
  • npm Version 10.5.2

Possible Issues

  • I tried updating the dependencies using: npm outdated->npm i -g npm-check-updates->ncu-u->npm install
  • It seems related to how oclifHandler is used in bin/run_bin.js.
  • oclif version mismatch.

Expected behavior

The commands executed from the cloned repository should function the same as those from the globally installed version npm install -g @asyncapi/cli, without encountering any TypeErrors.

Screenshots

Image

How to Reproduce

  • Fork & clone the repository
  • cd to cli directory
  • Install Dependencies: npm install
  • Linked the package globally: npm link
  • Verify Installation (Passed in my case): asyncapi --version
  • Run a CLI command (throws oclifHandler error)

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

Yes I am willing to submit a PR!

@Someshog Someshog added the bug Something isn't working label Mar 6, 2025
@github-project-automation github-project-automation bot moved this to To Triage in CLI - Kanban Mar 6, 2025
Copy link
Contributor

github-actions bot commented Mar 6, 2025

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.

@pseudo-tensor
Copy link

This is not a bug. The reason is that using npm link creates a symlink of run_bin.js which is set to use the Production environment. Production environment has many restrictions including preventing you from running code on raw .ts files, which is why you should either build using npm run build or if you're actively editing the code you can run npm run dev to create a dev server.

@Ervishalpathak7
Copy link
Contributor

i have fixed this with my latest PR #1697

@Someshog
Copy link
Author

Someshog commented Mar 7, 2025

I was using ./bin/run_bin [Commands] as an alternative but after doing the required oclif handler changes in run_bin file it worked fine!
Thanks @Ervishalpathak7

@Someshog Someshog closed this as completed Mar 7, 2025
@github-project-automation github-project-automation bot moved this from To Triage to Done in CLI - Kanban Mar 7, 2025
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
Status: Done
Development

No branches or pull requests

3 participants