-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
(1) does not exist, try --help #786
Comments
I was not able to reproduce with your code fragment, but it looks like you have (accidentally) invoked the Git-style sub-commands processing which searches for separate executables. Do you have code like |
I have same issue on Mac! Windows works. |
Is there a workaround/fix for this issue? It's affecting my automated build on linux as well, works fine on windows. |
It's terrible but works fine 🥇 I'have created a simple file he is looking for |
@fabioricali thanks for sharing, can you help me to understand the necessary changes to patch my application? |
Here is the workaround I am using for my project: package.json: ...
{
"bin" : { "my-script": "./my-script.js" }
}
... For windows the value ./my-script- is used to try and find the executable file. If the key and value in package json bin is the same it works fine on both unix and windows. We wont get the not found error (which occurs if package.json 's package.bin is "my-script" : "./index.js"). my-script.js var program = require('commander');
program
.command('start', 'Start application dev server.') // sub-command name
.command('build', 'Build application artifacts.')
.command('test', 'Run tests in application.')
.command('generate', 'Generate application w/ scafolding.')
.parse(process.argv); Folder structure:
|
any update on this? ive tried @fabioricali and @knyy's workarounds with no success. i cannot reproduce the issue locally using also, if i remove the globally installed yarn package and install with npm instead of yarn it works |
So how to fix this issues? |
Looking at the code and experimenting, Suppose you have a subcommand and have not created its source file yet:
With the package in a directory called
I see these results on macOS, and from description by @knyy there is a platform unix/windows difference for the first case as well.
So, tips:
|
I'm on Linux and found this issue while searching for subcommand "does not exist" errors. Simliar to @jameelmoses I found that In short,
|
Thanks for the work-arounds @david-mohr There is a change being prepared for release in Commander v2.20.0 which should help with the Yarn issue in particular: #935 |
@shadowspawn did it make the 2.20.0 release - I fear not? currently running 2.20.0 on MacOS it seems that even if one uses the As a side question, is is possible to have global options, and commands, such that the global option provide the ability to override the commands behavior. |
@acds |
There will be a work-around for this issue when v3.0.0 is released, with an |
Reworked the README and JSDoc and TypeScript to hopefully make the two modes of operation clearer. Have not changed the runtime, but will close this issue and see how the changes help. Shipped in v3: https://github.com/tj/commander.js/releases/tag/v3.0.0 |
…not exist, try --help’, ref: tj/commander.js#786
After calling
I get
Commands Run
Relevant Code
The text was updated successfully, but these errors were encountered: