PHP Artisan Optimize在生产服务器上失败 [英] Php artisan optimize is failing on production server

查看:537
本文介绍了PHP Artisan Optimize在生产服务器上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过bash脚本在生产服务器上运行composer installpost-install-cmd php artisan optimize处失败,错误为There are no commands defined in the "jwt" namespace.

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.

要尝试解决此问题,我在php artisan optimize

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",

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

在本地运行composer install可以正常工作.我可以毫无问题地通过脚本在本地运行命令.

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

通过生产服务器上的脚本运行composer install时发生故障.如果我登录到服务器并手动运行命令,则不会产生错误.

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?

推荐答案

尝试在服务器上的composer.json文件内添加预安装事件,请注意,只有当您的composer.lock存在并且您跑composer install:

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"
    ],
...
}

这篇关于PHP Artisan Optimize在生产服务器上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆