Php artisan migrate / optimize with error

Hey guys,

congratulations to the new RC for Version 5! :slight_smile:

I updated from v5.0.56 to 5.1.1 and InvoiceNinja ist not working anymore. laravel.log and invoiceninja.log are empty.

When I try sudo php artisan migrate or sudo php artisan optimize or sudo php artisan ninja:check-data I always get the same error:

PHP Warning:  require(/var/www/invoiceninja/vendor/composer/../symfony/var-dumper/Resources/functions/dump.php): failed to open stream: No such file or directory in /var/www/invoiceninja/vendor/composer/autoload_real.php on line 71
PHP Fatal error:  require(): Failed opening required '/var/www/invoiceninja/vendor/composer/../symfony/var-dumper/Resources/functions/dump.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/invoiceninja/vendor/composer/autoload_real.php on line 71

What can I do to fix this?

Thanks,
Gijs

I guess this is where it started:

sudo php artisan ninja:post-update

Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Package operations: 0 installs, 21 updates, 0 removals
  - Downloading symfony/process (v5.2.2)
  - Downloading symfony/filesystem (v5.2.2)
  - Downloading symfony/string (v5.2.2)
  - Downloading symfony/console (v5.2.2)
  - Downloading symfony/finder (v5.2.2)
  - Downloading composer/composer (2.0.9)
  - Downloading symfony/css-selector (v5.2.2)
  - Downloading symfony/var-dumper (v5.2.2)
  - Downloading symfony/routing (v5.2.2)
  - Downloading symfony/mime (v5.2.2)
  - Downloading symfony/http-foundation (v5.2.2)
  - Downloading symfony/event-dispatcher (v5.2.2)
  - Downloading symfony/error-handler (v5.2.2)
  - Downloading symfony/http-kernel (v5.2.2)
  - Downloading symfony/translation (v5.2.2)
  - Downloading nesbot/carbon (2.44.0)
  - Downloading google/apiclient-services (v0.157.1)
  - Downloading laravel/tinker (v2.6.0)
  - Downloading aws/aws-sdk-php (3.172.4)
  - Downloading symfony/http-client (v5.2.2)
  - Downloading symfony/options-resolver (v5.2.2)
  0/21 [>---------------------------]   0%
  4/21 [=====>----------------------]  19%
  9/21 [============>---------------]  42%
 11/21 [==============>-------------]  52%
 17/21 [======================>-----]  80%
 21/21 [============================] 100%  - Upgrading symfony/process (v5.2.1 => v5.2.2): Extracting archive
  - Upgrading symfony/filesystem (v5.2.1 => v5.2.2): Extracting archive
  - Upgrading symfony/string (v5.2.1 => v5.2.2): Extracting archive
  - Upgrading symfony/console (v5.2.1 => v5.2.2): Extracting archive
  - Upgrading symfony/finder (v5.2.1 => v5.2.2): Extracting archive
  - Upgrading composer/composer (2.0.8 => 2.0.9): Extracting archive
  - Upgrading symfony/css-selector (v5.2.1 => v5.2.2): Extracting archive
  - Upgrading symfony/var-dumper (v5.2.1 => v5.2.2): Extracting archive
  - Upgrading symfony/routing (v5.2.1 => v5.2.2): Extracting archive
  - Upgrading symfony/mime (v5.2.1 => v5.2.2): Extracting archive
  - Upgrading symfony/http-foundation (v5.2.1 => v5.2.2): Extracting archive
  - Upgrading symfony/event-dispatcher (v5.2.1 => v5.2.2): Extracting archive
  - Upgrading symfony/error-handler (v5.2.1 => v5.2.2): Extracting archive
  - Upgrading symfony/http-kernel (v5.2.1 => v5.2.2): Extracting archive
  - Upgrading symfony/translation (v5.2.1 => v5.2.2): Extracting archive
  - Upgrading nesbot/carbon (2.43.0 => 2.44.0): Extracting archive
  - Upgrading google/apiclient-services (v0.157.0 => v0.157.1): Extracting archive
  - Upgrading laravel/tinker (v2.5.0 => v2.6.0): Extracting archive
  - Upgrading aws/aws-sdk-php (3.172.1 => 3.172.4): Extracting archive
  - Upgrading symfony/http-client (v5.2.1 => v5.2.2): Extracting archive
  - Upgrading symfony/options-resolver (v5.2.1 => v5.2.2): Extracting archive
    Update of symfony/process failed
    Update of symfony/filesystem failed
    Update of symfony/string failed
    Update of symfony/console failed
    Update of symfony/finder failed
    Update of composer/composer failed
    Update of symfony/css-selector failed
    Update of symfony/var-dumper failed
    Update of symfony/routing failed
    Update of symfony/mime failed
  0/11 [>---------------------------]   0%    Update of symfony/http-foundation failed
    Update of symfony/event-dispatcher failed
    Update of symfony/error-handler failed
    Update of symfony/http-kernel failed
    Update of symfony/translation failed
    Update of laravel/tinker failed
    Update of symfony/http-client failed

  7/11 [=================>----------]  63%    Update of nesbot/carbon failed
    Update of symfony/options-resolver failed
    Update of aws/aws-sdk-php failed

 10/11 [=========================>--]  90%    Update of google/apiclient-services failed

 11/11 [============================] 100%
In ClassLoader.php line 444:
                                                                                                                                                                    
  include(/var/www/invoiceninja/vendor/composer/../composer/composer/src/Composer/Console/GithubActionError.php): failed to open stream: No such file or directory  
                                                                                                                                                                    

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-scripts] [--no-progress] [--no-install] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [<packages>...]

sh: vendor/bin/composer: Datei oder Verzeichnis nicht gefunden
PHP Fatal error:  Uncaught ErrorException: include(/var/www/invoiceninja/vendor/composer/../symfony/http-client/Response/ResponseStream.php): failed to open stream: No such file or directory in /var/www/invoiceninja/vendor/composer/ClassLoader.php:444
Stack trace:
#0 /var/www/invoiceninja/vendor/composer/ClassLoader.php(444): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
#1 /var/www/invoiceninja/vendor/composer/ClassLoader.php(444): include()
#2 /var/www/invoiceninja/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile()
#3 [internal function]: Composer\Autoload\ClassLoader->loadClass()
#4 /var/www/invoiceninja/vendor/symfony/http-client/CurlHttpClient.php(339): spl_autoload_call()
#5 /var/www/invoiceninja/vendor/symfony/http-client/Internal/HttplugWaitLoop.php(60): Symfony\Component\HttpClient\CurlHttpClient->stream()
#6 /var/www/invoiceninja/vendor/symfony/http-client/HttplugClient.php(143): Symfony\Component\HttpClient\Internal\HttplugWaitLoop->wait()
#7 /var/www/invoiceninja/vendor/symfony/ in /var/www/invoiceninja/vendor/composer/ClassLoader.php on line 444

I had it fixed by running:

sudo -u nginx php -d memory_limit=-1 which composer i --no-dev

1 Like

Hey there, by any new release there’s small chance new dependencies will be introduced. To make sure your app doesn’t break, I suggest doing following after updating to new version:

Install the missing dependencies:

composer install

Run any possible new migrations:

php artisan migrate

Optimize the cache/config:

php artisan optimize

This should fix the majority of problems after the update. :+1:

1 Like

Hi @ben

Is php artisan ninja:post-update part of the general version update process? And if not, is it recommended to run this command every now and then?

Thanks a lot and have a great weekend,
Gijs

@ecomsilio

Are you using the update feature from inside the app?

If yes, then the post-update command is called automatically. I’ve also added in a composer dump command which should prevent the initial error you saw.

2 Likes

Hi David,

I have had some errors in the laravel.log and tried to understand these errors and fix them manually.

So I did php artisan list to see what commands are available and that is why I came up with post-update.

Thanks,
Gijs

I received error when I run ninja:post-update …

silvia@zago:~/invoiceninja5/dockerfiles$ docker-compose exec app php artisan ninja:post-update

The “–no-dev:” option does not exist.

install [–prefer-source] [–prefer-dist] [–dry-run] [–dev] [–no-suggest] [–no-dev] [–no-autoloader] [–no-scripts] [–no-progress] [–no-install] [-v|vv|vvv|–verbose] [-o|–optimize-autoloader] [-a|–classmap-authoritative] [–apcu-autoloader] [–apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [–ignore-platform-req IGNORE-PLATFORM-REQ] [–ignore-platform-reqs] [–] […]