Closed tomsontom closed 1 year ago
@tomsontom, @msujew I don't see why this is not working, esp. because of the first line in the generated bin/cli.js
: https://github.com/eclipse-langium/langium/blob/6f22f22b7ff67a88061b16c46087d92c57a6d596/packages/generator-langium/templates/cli/bin/cli.js#L1
Actually, it's deliberately supposed to work without calling node
explicitly.
Just gave it a try on my own:
@sailingKieler You fail to see it, because you have a Mac :)
It didn't work on Windows (as mentioned in the initial issue comment). Windows is fairly strict about what it accepts as an executable via the command line - which is why calling node
first is necessary on Windows. Closing the issue.
Indeed, I thought in that direction but the description says:
And the zsh:
confused me 😉
Hm, I see. No idea, though using node
should work anyway as expected ¯\_(ツ)_/¯
@sailingKieler - correct the error from above is produced on my OS-X
yo langium
to bootstrapcli
hence the file not found error is at least to me expected@msujew - on windows (unless you run in WSL) I don't think windows can do anything with #!/usr/bin/env node
- at least I would be very suprised and according to https://stackoverflow.com/questions/10396305/npm-package-bin-script-for-windows it is simply ignored but I confess I have not tried but as you wrote using "node" is the safeway and works just anywhere.
@tomsontom you're right, since v2.0 ./bin/cli
will be generated as ./bin/cli.js
. (I had v1.0.0 in my global installation.)
@msujew what's the rationale for this renaming? See https://github.com/eclipse-langium/langium/commit/eea5bc2b5621cc8a321c4b95d4ca63f0aa5324fe#diff-78f8cabeb67c251201d63c1fc548b398062430670a22c6f5664def651d1a8f1a
Well I think this how it is supposed to be in node/npm - if you package this up then npm automatically creates the wrapper so that the end user can really run "./bin/cli" - It is also mentionned in the stackoverflow link from above
Langium version: 2.0.0 Package name: langium-generator
Steps To Reproduce
./bin/cli
which leads to the following error (on OS-X)The current behavior
Command shown langium-quickstart.md does not work.
The expected behavior
Command shown in langium-quickstart.md should work unversially
Possible ways to solve
cli.js
to be executable and change command to./bin/cli.js
node ./bin/cli.js
If not mistaken although I think shebang-lines don't work on Windows so I think the proper way is to change the readme to use the 2nd option