Laravel Forge deploy errors from Composer update - laravel

My application works fine locally and is running on Digital Ocean. But I am getting the following two alternate deploy errors on Laravel Forge.
If I run:
composer update --no-dev
php artisan optimize
then I get the following error on 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.
If I run:
composer update
php artisan optimize
then I get this on 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
What am I doing wrong?

probably the easiest thing to do here is this.
in your local development environment double check your composer.json file for any items in the "require" section which should be in the "require-dev" section and move them if need be
Delete your local composer.lock file
Run composer install composer update -vvv
Test your application locally
When satisfied that everything is working in line with your expectations commit your composer.lock file back to your version control system and redeploy the application on Forge
If you continue to get errors on deploy and there is nothing else of worth on the server I'd destroy your old server instance then create a new server on Forge. Have it run the build with the new composer.lock file and I'm sure it will get you past this issue. :-D
On another note which may help, generally on deployment I'll favour composer install over composer update on the basis I'll have tested functionality based on specific versions of dependencies which are recorded in the composer.lock file. Following that approach means application behaviour should be more predictable. You'll risk encoutering unpredictable behaviour where you or one of your dependencies relies on a library which is always the latest version (e.g. dev-master) since the code could be changing very frequently.

Related

How to install Laravel v5.2.15 when I have already installed v5.6.12?

I am trying to install a lower version of laravel when I have already installed a higher version in my htdocs. But it throws an error.
C:\xampp\htdocs\laravel-6>composer create-project laravel/laravel=5.2.15 s6
Installing laravel/laravel (v5.2.15)
- Installing laravel/laravel (v5.2.15): Loading from cache
Created project in s6
> php -r "copy('.env.example', '.env');"
> php artisan clear-compiled
PHP Warning: require(C:\xampp\htdocs\laravel-6\s6\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\laravel-6\s6\bootstrap\autoload.php on line 17
PHP Stack trace:
PHP 1. {main}() C:\xampp\htdocs\laravel-6\s6\artisan:0
PHP 2. require() C:\xampp\htdocs\laravel-6\s6\artisan:16
PHP Fatal error: require(): Failed opening required 'C:\xampp\htdocs\laravel-6\s6\bootstrap/../vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\laravel-6\s6\bootstrap\autoload.php on line 17
PHP Stack trace:
PHP 1. {main}() C:\xampp\htdocs\laravel-6\s6\artisan:0
PHP 2. require() C:\xampp\htdocs\laravel-6\s6\artisan:16
Warning: require(C:\xampp\htdocs\laravel-6\s6\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\laravel-6\s6\bootstrap\autoload.php on line 17
Call Stack:
0.0007 344912 1. {main}() C:\xampp\htdocs\laravel-6\s6\artisan:0
0.0016 346488 2. require('C:\xampp\htdocs\laravel-6\s6\bootstrap\autoload.php') C:\xampp\htdocs\laravel-6\s6\artisan:16
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\laravel-6\s6\bootstrap/../vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\laravel-6\s6\bootstrap\autoload.php on line 17
Call Stack:
0.0007 344912 1. {main}() C:\xampp\htdocs\laravel-6\s6\artisan:0
0.0016 346488 2. require('C:\xampp\htdocs\laravel-6\s6\bootstrap\autoload.php') C:\xampp\htdocs\laravel-6\s6\artisan:16
Script php artisan clear-compiled handling the pre-update-cmd event returned with error code 255
But when I tried installing laravel v5.6.12, it gets installed easily again. Please tell me a way around to install a lower version of laravel while keeping the higher version. Thanks.
Errors:Updates suggested by a member
I was suggested to download laravel's particular version manually and I did also tried to update composer but still facing problem. The error that has occurred is shown below:
Have you tried using this command to install a clean copy of laravel 5.2.15?
composer create-project --prefer-dist laravel/laravel laravelProjectFolder "5.2.15"

Laravel CLI fails to create new app due to Cannot use lexical variable $eventName as a parameter name

After successful installation of Laravel's install tool using composer using composer global require "laravel/installer" command, the first attempt to create an application by running laravel new app-name fails with the following output, any advice will be appreciated :)
Crafting application...
PHP Fatal error: Cannot use lexical variable $eventName as a parameter name in /Users/ABN/.composer/vendor/guzzlehttp/guzzle/src/Event/Emitter.php on line 48
PHP Stack trace:
PHP 1. {main}() /Users/ABN/.composer/vendor/laravel/installer/laravel:0
PHP 2. Symfony\Component\Console\Application->run() /Users/ABN/.composer/vendor/laravel/installer/laravel:13
PHP 3. Symfony\Component\Console\Application->doRun() /Users/ABN/.composer/vendor/symfony/console/Application.php:126
PHP 4. Symfony\Component\Console\Application->doRunCommand() /Users/ABN/.composer/vendor/symfony/console/Application.php:195
PHP 5. Laravel\Installer\Console\NewCommand->run() /Users/ABN/.composer/vendor/symfony/console/Application.php:878
PHP 6. Laravel\Installer\Console\NewCommand->execute() /Users/ABN/.composer/vendor/symfony/console/Command/Command.php:259
PHP 7. Laravel\Installer\Console\NewCommand->download() /Users/ABN/.composer/vendor/laravel/installer/src/NewCommand.php:52
PHP 8. GuzzleHttp\Client->get() /Users/ABN/.composer/vendor/laravel/installer/src/NewCommand.php:125
PHP 9. GuzzleHttp\Client->createRequest() /Users/ABN/.composer/vendor/guzzlehttp/guzzle/src/Client.php:125
PHP 10. GuzzleHttp\Client->getEmitter() /Users/ABN/.composer/vendor/guzzlehttp/guzzle/src/Client.php:115
PHP 11. spl_autoload_call() /Users/ABN/.composer/vendor/guzzlehttp/guzzle/src/Event/HasEmitterTrait.php:15
PHP 12. Composer\Autoload\ClassLoader->loadClass() /Users/ABN/.composer/vendor/guzzlehttp/guzzle/src/Event/HasEmitterTrait.php:15
PHP 13. Composer\Autoload\includeFile() /Users/ABN/.composer/vendor/composer/ClassLoader.php:322
Turned out the issue is related to the guzzle version installed on the system.
After seeing similar issue reported around guzzle 5.3 on some other repositories/apps, confirmed my globally installed version by running composer global info guzzlehttp/guzzle and it was 5.3.
Then updating my composer's global installation by running composer global updatesolved the problem, after seeing the update report as shown bellow, running the same laravel new app-name generates the application successfully.
Updating guzzlehttp/guzzle (5.3.0 => 6.2.3): Downloading (100%)
This is related to Guzzle's PHP 7.x incompatibility and this has been fixed in Guzzle >=5.3.1.
The solution is to upgrade your Guzzle by modifying line in your composer.json file to:
"guzzlehttp/guzzle": "~5.3.1",
or:
"guzzlehttp/guzzle": "~5.3#stable",

Fresh CentOS 7, first Laravel Installation.Composer install breaks

I am fallowing this tutorial:
http://linoxide.com/linux-how-to/install-laravel-php-centos-7-ubuntu-15-04/
And on step 5) when running composer install in the project directory it starts to do staff, as expected, until this happened:
Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize
PHP Fatal error: Undefined constant 'Illuminate\Session\TokenMismatchException' in /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 779
PHP Fatal error: Undefined constant 'Illuminate\Session\TokenMismatchException' in /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 779
Script php artisan optimize handling the post-install-cmd event returned with error code 255
What is the problem?
Thanks, Aleks
start creating a project (after updating composer) instead of downloading the referenced file do the following
from your terminal type in cd /var/www/
then type composer create-project laravel/laravel laravel-develop
your composer should download the latest version of Laravel
try it this way feel free to ask any questions.
Good Luck

composer update error on fresh installation of laravel 5

After i get fresh installation of laravel 5 via composer create-project laravel/laravel i tried to update composer.json file via composer update but alway get this error. Someone knows why?
[RuntimeException]
Error Output: PHP Fatal error: Call to undefined method Illuminate\Foundation\Applicat
ion::getCachedCompilePath() in /home/vagrant/Code/zadarplus/vendor/laravel/framework/sr
c/Illuminate/Foundation/Console/ClearCompiledCommand.php on line 28
PHP Stack trace:
PHP 1. {main}() /home/vagrant/Code/zadarplus/artisan:0
PHP 2. Illuminate\Foundation\Console\Kernel->handle() /home/vagrant/Code/zadarplus/ar
tisan:36
PHP 3. Symfony\Component\Console\Application->run() /home/vagrant/Code/zadarplus/vend
or/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:94
PHP 4. Symfony\Component\Console\Application->doRun() /home/vagrant/Code/zadarplus/ve
ndor/symfony/console/Symfony/Component/Console/Application.php:126
PHP 5. Symfony\Component\Console\Application->doRunCommand() /home/vagrant/Code/zadar
plus/vendor/symfony/console/Symfony/Component/Console/Application.php:195
PHP 6. Illuminate\Console\Command->run() /home/vagrant/Code/zadarplus/vendor/symfony/
console/Symfony/Component/Console/Application.php:874
PHP 7. Symfony\Component\Console\Command\Command->run() /home/vagrant/Code/zadarplus/
vendor/laravel/framework/src/Illuminate/Console/Command.php:101
PHP 8. Illuminate\Console\Command->execute() /home/vagrant/Code/zadarplus/vendor/symf
ony/console/Symfony/Component/Console/Command/Command.php:257
PHP 9. Illuminate\Container\Container->call() /home/vagrant/Code/zadarplus/vendor/lar
avel/framework/src/Illuminate/Console/Command.php:115
PHP 10. call_user_func_array:{/home/vagrant/Code/zadarplus/vendor/compiled.php:925}()
/home/vagrant/Code/zadarplus/vendor/compiled.php:925
PHP 11. Illuminate\Foundation\Console\ClearCompiledCommand->fire() /home/vagrant/Code/
zadarplus/vendor/compiled.php:925
Seems something went wrong during the "compilation".
Delete vendor/compiled.php and run composer update again.
If that didn't work out, delete storage/framework/compiled.php, too.

Fatal Error "Class...not found" on Using Composer Install on CLI

i'm installing composer for laravel 4, and on hitting composer install on the CLI, and on hitting Enter i get the following error/warnings:
`
F:\My Documents\WAMP\www\laravel-master>composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to u
pdate them.
Nothing to install or update
Generating autoload files
PHP Fatal error: Class 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider' not found in F:\My Documents\WAMP\www\laravel-master
\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php on line 123
PHP Stack trace:
PHP 1. {main}() F:\My Documents\WAMP\www\laravel-master\artisan:0
PHP 2. require_once() F:\My Documents\WAMP\www\laravel-master\artisan:30
PHP 3. require() F:\My Documents\WAMP\www\laravel-master\bootstrap\start.php:60
PHP 4. Illuminate\Foundation\ProviderRepository->load() F:\My Documents\WAMP\www\laravel-master\vendor\laravel\framework\src\Illuminate\Fo
undation\start.php:195
PHP 5. Illuminate\Foundation\ProviderRepository->compileManifest() F:\My Documents\WAMP\www\laravel-master\vendor\laravel\framework\src\Il
luminate\Foundation\ProviderRepository.php:51
PHP 6. Illuminate\Foundation\ProviderRepository->createProvider() F:\My Documents\WAMP\www\laravel-master\vendor\laravel\framework\src\Ill
uminate\Foundation\ProviderRepository.php:89
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'Illuminate\\Foundation\\Providers\\ConsoleSup
portServiceProvider' not found","file":"F:\\My Documents\\WAMP\\www\\laravel-master\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation
\\ProviderRepository.php","line":123}}Script php artisan clear-compiled handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output: PHP Fatal error: Class 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider' not found in F:\My Documents\WAMP
\www\laravel-master\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php on line 123
PHP Stack trace:
PHP 1. {main}() F:\My Documents\WAMP\www\laravel-master\artisan:0
PHP 2. require_once() F:\My Documents\WAMP\www\laravel-master\artisan:30
PHP 3. require() F:\My Documents\WAMP\www\laravel-master\bootstrap\start.php:60
PHP 4. Illuminate\Foundation\ProviderRepository->load() F:\My Documents\WAMP\www\laravel-master\vendor\laravel\framework\src\Illumina
te\Foundation\start.php:195
PHP 5. Illuminate\Foundation\ProviderRepository->compileManifest() F:\My Documents\WAMP\www\laravel-master\vendor\laravel\framework\s
rc\Illuminate\Foundation\ProviderRepository.php:51
PHP 6. Illuminate\Foundation\ProviderRepository->createProvider() F:\My Documents\WAMP\www\laravel-master\vendor\laravel\framework\sr
c\Illuminate\Foundation\ProviderRepository.php:89
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progre
ss] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [packagesN]
What could be the problem? I've tried searching up everywhere on google but no success.
i succeeded. this is what i did: 1. i enabled openssl on the 2 php.ini files in the bin/apache and bin/php folders of my WAMP. 2. i was initially using Internet with proxy. I switched to modem and my woes were over. This was the main reason for the success. i hope all this helps somebody

Resources