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

exception 'InvalidArgumentException' with message 'There are no commands defined in the "xxx" namespace.' #68

Closed
nebestpal opened this issue Aug 24, 2014 · 27 comments

Comments

@nebestpal
Copy link

I'm getting this error:

[2014-08-24 20:19:02] staging.ERROR: exception 'InvalidArgumentException' with message 'There are no commands defined in the "trusty" namespace.' in /home/trustywebapp/public_html/stagingtrusty/vendor/symfony/console/Symfony/Component/Console/Application.php:516
Stack trace:
#0 /home/trustywebapp/public_html/stagingtrusty/vendor/symfony/console/Symfony/Component/Console/Application.php(550): Symfony\Component\Console\Application->findNamespace('trusty')
#1 /home/trustywebapp/public_html/stagingtrusty/vendor/symfony/console/Symfony/Component/Console/Application.php(190): Symfony\Component\Console\Application->find('trusty:log')
#2 /home/trustywebapp/public_html/stagingtrusty/vendor/symfony/console/Symfony/Component/Console/Application.php(124): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /home/trustywebapp/public_html/stagingtrusty/artisan(58): Symfony\Component\Console\Application->run()
#4 {main} [] []

This is what I put in the cpanel cron job:
php /home/trustywebapp/public_html/stagingtrusty/artisan scheduled:run 1>> /dev/null 2>&1

Pls help.

@bkuhl
Copy link
Member

bkuhl commented Aug 24, 2014

This doesn't look like anything to do with dispatcher, but an issue with the commands themselves. Please verify all of your artisan commands are able to be run standalone, outside of scheduled:run.

@nebestpal
Copy link
Author

The command runs perfectly as standalone, but throws error when I used this package.

@bkuhl
Copy link
Member

bkuhl commented Aug 24, 2014

The stack trace indicates that it's trying to run artisan trusty:log but the trusty command namespace could not be found. Are you saying that you when login to this environment you're able to run the artisan trusty:log command successfully?

@nebestpal
Copy link
Author

Yes I was able to run it successfully by running artisan trusty:log
This is what I put into the cron job

The cron looks like this

  • * * * * php /home/trustywebapp/public_html/stagingtrusty/artisan scheduled:run 1>> /dev/null 2>&1

When I replace the "scheduled:run 1>> /dev/null 2>&1" with "trusty:log" it works.

Reverting back keeps throwing the error: " no commands defined in the "trusty" namespace"

I'm not sure why. Perhaps it's the cron problem. Because when I ssh'd and run: php /home/trustywebapp/public_html/stagingtrusty/artisan scheduled:run 1>> /dev/null 2>&1
it works, but fails again when I try to use cron job in cpanel.

@nebestpal
Copy link
Author

Got this to work by changing this

  • * * * php /home/trustywebapp/public_html/stagingtrusty/artisan scheduled:run 1>> /dev/null 2>&1
    to this
  • * * * php /home/trustywebapp/public_html/stagingtrusty/artisan "scheduled:run" 1>> /dev/null 2>&1

Notice the double quotes around "scheduled:run"

@bkuhl
Copy link
Member

bkuhl commented Aug 29, 2014

That's pretty odd... glad to hear you got it working though!

@drakakisgeo
Copy link

Have the same problem. Command runs without any problem standalone. Double quotes didn't fix anything for me.

"InvalidArgumentExceptionvendor/symfony/console/Symfony/Component/Console/Application.php:516
There are no commands defined in the "xxx" namespace."

Also changed the executable setting to be "/usr/bin/php5-cli" that is true in my case. Again no luck.

@bkuhl
Copy link
Member

bkuhl commented Nov 8, 2014

I had this issue on a server earlier this week and using php-cli resolved the issue for me. If that doesn't work for your server, I'm not sure what to try next.

@drakakisgeo
Copy link

Thing is that is working ok without the dispacher. Anyway I'll try some things and let you know.

@cnanney
Copy link

cnanney commented Nov 9, 2014

Just starting testing out Dispatcher today, running into this same issue. php-cli doesn't work, double quotes around scheduled:run doesn't work.

Still get There are no commands defined in the "av" namespace., but can ssh in and run artisan av:command and it executes just fine.

@drakakisgeo
Copy link

Any idea? Keep getting that, so basically I can't use it in my live server.

@bkuhl
Copy link
Member

bkuhl commented Nov 19, 2014

The challenge I'm facing here is that I don't believe this is an issue with Dispatcher, it's an underlying issue with Laravel and/or Symfony (probably symfony). Dispatcher is simply generating a linux command and running that in a background process.

Have you tried running the exact command that Dispatcher generates manually on the server? Whether this executable command is configured or not, it should produce consistent results manually as it does being run by Dispatcher.

@mattglover11
Copy link

I am also having the same problem in production. Works find locally but can't get it to run on the production server

@mattglover11
Copy link

php artisan notification:day
[InvalidArgumentException]
There are no commands defined in the "notification" namespace.

php-cli artisan notification:day works fine.

php artisan scheduled:run
[InvalidArgumentException]
There are no commands defined in the "notification" namespace.

php-cli artisan scheduled:run
[InvalidArgumentException]
There are no commands defined in the "notification" namespace.

@bkuhl
Copy link
Member

bkuhl commented Nov 20, 2014

@SparkEleven In 1.X commands don't inherit the php executable from scheduled:run (though they do in 2.0@dev). Did you configure the executable config (see https://github.com/Indatus/dispatcher/releases/tag/v1.4.1) to use php-cli?

@mattglover11
Copy link

OK, brilliant that works, thanks.

@bkuhl
Copy link
Member

bkuhl commented Nov 20, 2014

Does this solve the issue for anyone else that hasn't tried this?

@drakakisgeo
Copy link

Its ok now. I have changed the config in the local env by mistake. Changed that, worked fine.

@cnanney
Copy link

cnanney commented Nov 20, 2014

Setting the executable in config fixed it for me too, thanks.

@ideadx
Copy link

ideadx commented Dec 15, 2014

Awesome, Thanks.

@ideadx
Copy link

ideadx commented Dec 15, 2014

Fix:
Open: /Vandor/indatus/dispatcher/src/config/config.php
and set
'executable' => null
to
your cron path

@caneco
Copy link

caneco commented Jan 21, 2015

This has been solved?

I'm trying to use Dispacher and I keep getting this error… I've already read all the comments as make all suggestion and still no luck.

@mattglover11
Copy link

@caneco in my /app/config/packages/indatus/dispatcher/config.php I have

'executable' => '/usr/bin/php-cli'

Does that help?

@caneco
Copy link

caneco commented Jan 23, 2015

@SparkEleven that really made the trick! Thank you!

@xwlee
Copy link

xwlee commented Feb 13, 2015

@SparkEleven Thank, it solved!

@ideadx
Copy link

ideadx commented Jun 23, 2015

if you dont find config files in app/config
run: php artisan config:publish indatus/dispatcher

@caneco
Copy link

caneco commented Jun 23, 2015

On the other day this happened to me with this issue…

a6pswtfcuai7n-5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants