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

TS Error when run generation #574

Closed
Tenischev opened this issue May 22, 2023 · 22 comments
Closed

TS Error when run generation #574

Tenischev opened this issue May 22, 2023 · 22 comments
Labels
bug Something isn't working stale

Comments

@Tenischev
Copy link
Member

Tenischev commented May 22, 2023

Describe the bug

TypeScript error when run generation from template/

How to Reproduce

  1. Install node (tested with 16 and 18)
  2. Install latest cli
  3. Checkout asyncapi/java-spring-template
  4. Run command asyncapi generate fromTemplate tests/mocks/mqtt.yml @asyncapi/java-spring-template -o spring-output-test
  5. Error:
error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node12', 'nodenext'.

Additional details:
OS - Windows 11

asyncapi --version
@asyncapi/cli/0.40.8 win32-x64 node-v16.20.0

Expected behavior

No error when run generation from template

@Tenischev Tenischev added the bug Something isn't working label May 22, 2023
@github-actions
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.

Copy link
Member

derberg commented May 23, 2023

@Souvikns I think you have access to windows, can you help with this issue 🙏

@Tenischev
Copy link
Member Author

here step by step drill down of commands, maybe this will help
image

@Souvikns
Copy link
Member

OK, I am getting the same error on Mac as well.

@Souvikns
Copy link
Member

The command is running on the codebase without any issue, but in production, it is not working, I checked and all other commands are working, might be something wrong with the generator.

Not a fix but you can run the command by passing --module flag run asyncapi generate fromTemplate --module=none <rest of the parameters>

@Tenischev
Copy link
Member Author

Not a fix but you can run the command by passing --module flag run asyncapi generate fromTemplate --module=none <rest of the parameters>

Nope
image

Copy link
Member

derberg commented May 23, 2023

generator do not support --module, the error comes like from TS compiler I think

@Souvikns
Copy link
Member

Souvikns commented May 23, 2023

@Tenischev can you install typescript globally and try to run the command, it worked for me.

Screenshot 2023-05-23 at 4 19 11 PM

generator do not support --module, the error comes like from TS compiler I think

Yeah, the generator is written in javascript, it is a typescript issue.

Copy link
Member

derberg commented May 23, 2023

does it mean that typescript has to be moved to dependencies? it shouldn't be needed in production right? typescript should be required only in build time

@Souvikns
Copy link
Member

does it mean that typescript has to be moved to dependencies? it shouldn't be needed in production right? typescript should be required only in build time

typescript is just a compiler right we should not need it in production, no idea why this is happening.

https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html looking at this typescript could be used as a dependency

Copy link
Member

derberg commented May 24, 2023

interesting

@Tenischev can you confirm if after typescript installation the issue was fixed?

@Tenischev
Copy link
Member Author

@Tenischev can you confirm if after typescript installation the issue was fixed?

Not confirmed
image

@chinma-yyy
Copy link
Contributor

Working for me for the latest release
image

Copy link
Member

derberg commented Jun 27, 2023

@Tenischev can you give it another try with latest 🙏

@Tenischev
Copy link
Member Author

@derberg the problem still there
image

@Souvikns
Copy link
Member

@Tenischev did you install the CLI using npm?

Copy link
Member

derberg commented Jul 13, 2023

@Souvikns I don't think it matters. I had the same issue 2 days ago and did not have time to open a PR, but my idea for the fix was pretty dummy, removal of package-lock.json and then npm i to refresh dependencies and the lock file and add it to the PR. Cause 2 days ago I was playing with AsyncAPI CLI and AsyncAPI Generator CLI both from sources, and they both had issue and reinstallation of fresh dependencies fixed the problem. I suspect some dependency of dependency released some bug, and refresh of dependencies then makes a use of a fix I think. I hope that makes sense.

@Souvikns
Copy link
Member

Oh ok, I will then open a PR updating the package-lock. I was thinking that maybe packaging it into different installers creates a problem.

@derberg
Copy link
Member

derberg commented Jul 20, 2023

@Tenischev 0.51 that was just released should fix it 🤞🏼

@Tenischev
Copy link
Member Author

Tenischev commented Sep 1, 2023

@derberg I have a small update here.
For the version @asyncapi/cli/0.54.4 win32-x64 node-v18.17.1.
CLI-Generator will work IF:

  1. CMD is located in system volume (drive C for most Windows systems)
  2. CMD is run with Administrator privileges.

image
In other cases I receive the same error "error TS6046: ..."

Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label Dec 31, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 30, 2024
Copy link
Collaborator

Amzani commented Apr 30, 2024

@Tenischev are you still experiencing this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
Archived in project
Development

No branches or pull requests

5 participants