1

Running composer install on a production server via a bash script is failing at post-install-cmd php artisan optimize with the error There are no commands defined in the "jwt" namespace.

To try to resolve the issue I added the following commands before php artisan optimize

"php artisan clear-compiled", "php artisan cache:clear", "php artisan config:clear", "php artisan config:cache",

Running composer install locally works fine. I can run the commands through a script locally without a problem.

The failure is happening while running composer install through a script on the production server. If I log onto the server and run the commands manually I do not generate the error.

Not sure how to debug, any ideas?

Iannazzi
  • 1,348
  • 2
  • 18
  • 27

1 Answers1

1

Try adding a pre-install event inside of your composer.json file on the server, note that this event works only if your composer.lock is present and you ran composer install:

"scripts": {
    "pre-install-cmd": [
        "php artisan config:clear"
    ],
...
}
Nikola Gavric
  • 3,507
  • 1
  • 8
  • 16
  • 1
    I am pretty sure I did that. For others who run into the situation I ended up downgrading to laravel 5.4 as this was a result of upgrading to laravel 5.5 and 5.6. It may be coming from `dingo/api`... with the error being so vague I just couldn't find the source – Iannazzi Feb 11 '18 at 18:28