我的应用程序在本地工作正常,并在Digital Ocean上运行。但是我在Laravel Forge上遇到以下两个备用部署错误。
如果我跑:
composer update --no-dev
php artisan optimize
然后我在Forge上收到以下错误:
[RuntimeException]
The lock file does not contain require-dev information, run install with the --no-dev option or run update to install those packages.
如果我跑:
composer update
php artisan optimize
然后我在Forge上得到了这个:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
PHP Fatal error: Call to undefined method
Illuminate\Foundation\Application::getCachedCompilePath() in /home/forge/default/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php on line 28
PHP Stack trace:
PHP 1. {main}() /home/forge/default/artisan:0
PHP 2. Illuminate\Foundation\Console\Kernel->handle() /home/forge/default/artisan:36
PHP 3. Symfony\Component\Console\Application->run() /home/forge/default/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:94
PHP 4. Symfony\Component\Console\Application->doRun() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:126
PHP 5. Symfony\Component\Console\Application->doRunCommand() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:195
PHP 6. Illuminate\Console\Command->run() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:874
PHP 7. Symfony\Component\Console\Command\Command->run() /home/forge/default/vendor/laravel/framework/src/Illuminate/Console/Command.php:101
PHP 8. Illuminate\Console\Command->execute() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
PHP 9. Illuminate\Container\Container->call() /home/forge/default/vendor/laravel/framework/src/Illuminate/Console/Command.php:115
PHP 10. call_user_func_array:{/home/forge/default/storage/framework/compiled.php:925}() /home/forge/default/storage/framework/compiled.php:925
PHP 11. Illuminate\Foundation\Console\ClearCompiledCommand->fire() /home/forge/default/storage/framework/compiled.php:925
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
[RuntimeException
Error Output: PHP Fatal error: Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath() in /home/forge/default/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php on line 28
PHP Stack trace:
PHP 1. {main}() /home/forge/default/artisan:0
PHP 2. Illuminate\Foundation\Console\Kernel->handle() /home/forge/default/artisan:36
PHP 3. Symfony\Component\Console\Application->run() /home/forge/default/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:94
PHP 4. Symfony\Component\Console\Application->doRun() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:126
PHP 5. Symfony\Component\Console\Application->doRunCommand() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:195
PHP 6. Illuminate\Console\Command->run() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:874
PHP 7. Symfony\Component\Console\Command\Command->run() /home/forge/default/vendor/laravel/framework/src/Illuminate/Console/Command.php:101
PHP 8. Illuminate\Console\Command->execute() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
PHP 9. Illuminate\Container\Container->call() /home/forge/default/vendor/laravel/framework/src/Illuminate/Console/Command.php:115
PHP 10. call_user_func_array:{/home/forge/default/storage/framework/compiled.php:925}() /home/forge/default/storage/framework/compiled.php:925
PHP 11. Illuminate\Foundation\Console\ClearCompiledCommand->fire() /home/forge/default/storage/framework/compiled.php:925
我做错了什么?
答案 0 :(得分:2)
这里最容易做的事就是这个。
composer update -vvv
如果你继续在部署时遇到错误,并且服务器上没有任何其他值得的东西我会破坏你的旧服务器实例,然后在Forge上创建一个新的服务器。让它使用新的composer.lock文件运行构建,我相信它会让你解决这个问题。 :-D
另一个可能有帮助的注意事项,通常在部署时我会支持composer install
而不是composer update
,因为我将根据作曲家中记录的特定版本的依赖项测试功能。锁定文件。遵循该方法意味着应用程序行为应该更加可预测。如果您或您的某个依赖项依赖于始终是最新版本的库(例如dev-master),您将面临无法预测的行为,因为代码可能会经常更改。