Class LaravelCrawlerDetect does not exist

After updating the files to latest 4.1.5, I am now getting the error:

PHP message: PHP Fatal error: Uncaught ReflectionException: Class LaravelCrawlerDetect does not exist in /var/www/clients/client1/web2/web/bootstrap/cache/compiled.php:1479

I tried reverting to the former version, but the same error comes up. I also tried fresh upload of the latest files but I get the same error.

The file I used came from https://download.invoiceninja.com/ninja-v4.1.5.zip.

Thanks.

If you have command line access can you try running php artisan optimize

Hi,

i try to install invoiceninja on Debian 9 with Mariadb and NGINX.

The Version is most actual from your git repo.

I have the same Error as describt abov, to call “php artisan optimize” do not change this situation.
There is no log entry.

dieter@yoda:/srv/ninja/code$ php artisan optimize
#PHP Fatal error: Uncaught ReflectionException: Class LaravelCrawlerDetect does not exist in /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php:749
Stack trace:
#0 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(749): ReflectionClass->__construct(‘LaravelCrawlerD…’)
#1 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(644): Illuminate\Container\Container->build(‘LaravelCrawlerD…’, Array)
#2 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(709): Illuminate\Container\Container->make(‘LaravelCrawlerD…’, Array)
#3 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(1203): Illuminate\Foundation\Application->make(‘LaravelCrawlerD…’)
#4 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(175): Illuminate\Container\Container->offsetGet(‘LaravelCrawlerD…’)
#5 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(144) in /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 749
PHP Fatal error: Uncaught ReflectionException: Class LaravelCrawlerDetect does not exist in /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php:749
Stack trace:
#0 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(749): ReflectionClass->__construct(‘LaravelCrawlerD…’)
#1 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(644): Illuminate\Container\Container->build(‘LaravelCrawlerD…’, Array)
#2 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(709): Illuminate\Container\Container->make(‘LaravelCrawlerD…’, Array)
#3 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(1203): Illuminate\Foundation\Application->make(‘LaravelCrawlerD…’)
#4 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(175): Illuminate\Container\Container->offsetGet(‘LaravelCrawlerD…’)
#5 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(144) in /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 749

Best regards,

Dieter

Have you run composer install?

Yes,

dieter@yoda:/srv/ninja/code$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 29 installs, 0 updates, 0 removals

  • Installing codeception/c3 (2.0.14): Loading from cache
    [codeception/c3] Copying c3.php to the root of your project…
    [codeception/c3] Include c3.php into index.php in order to collect codecoverage from server scripts
  • Installing symfony/dom-crawler (v3.4.0): Loading from cache
  • Installing symfony/browser-kit (v3.4.0): Loading from cache
  • Installing stecman/symfony-console-completion (0.7.0): Loading from cache
  • Installing sebastian/diff (1.4.3): Loading from cache
  • Installing sebastian/recursion-context (1.0.5): Loading from cache
  • Installing sebastian/exporter (1.2.2): Loading from cache
  • Installing sebastian/comparator (1.2.4): Loading from cache
  • Installing phpunit/php-text-template (1.2.1): Loading from cache
  • Installing doctrine/instantiator (1.0.5): Loading from cache
  • Installing phpunit/phpunit-mock-objects (2.3.8): Loading from cache
  • Installing sebastian/version (1.0.6): Loading from cache
  • Installing sebastian/global-state (1.1.1): Loading from cache
  • Installing sebastian/environment (1.3.8): Loading from cache
  • Installing phpunit/php-timer (1.0.9): Loading from cache
  • Installing phpunit/php-file-iterator (1.4.5): Loading from cache
  • Installing phpunit/php-token-stream (1.4.11): Loading from cache
  • Installing phpunit/php-code-coverage (2.2.4): Loading from cache
  • Installing webmozart/assert (1.2.0): Loading from cache
  • Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
  • Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
  • Installing phpdocumentor/reflection-docblock (4.2.0): Loading from cache
  • Installing phpspec/prophecy (1.7.3): Loading from cache
  • Installing phpunit/phpunit (4.8.36): Loading from cache
  • Installing facebook/webdriver (1.5.0): Loading from cache
  • Installing behat/gherkin (v4.4.5): Loading from cache
  • Installing codeception/codeception (2.3.3): Loading from cache
  • Installing phpspec/php-diff (v1.0.2): Loading from cache
  • Installing phpspec/phpspec (2.5.8): Loading from cache
    phpunit/phpunit-mock-objects suggests installing ext-soap ()
    sebastian/global-state suggests installing ext-uopz (
    )
    phpunit/php-code-coverage suggests installing ext-xdebug (>=2.2.1)
    phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
    codeception/codeception suggests installing codeception/specify (BDD-style code blocks)
    codeception/codeception suggests installing codeception/verify (BDD-style assertions)
    codeception/codeception suggests installing flow/jsonpath (For using JSONPath in REST module)
    codeception/codeception suggests installing league/factory-muffin (For DataFactory module)
    codeception/codeception suggests installing league/factory-muffin-faker (For Faker support in DataFactory module)
    codeception/codeception suggests installing symfony/phpunit-bridge (For phpunit-bridge support)
    phpspec/phpspec suggests installing phpspec/nyan-formatters (~1.0 – Adds Nyan formatters)
    Package chumper/datatable is abandoned, you should avoid using it. Use OpenSkill/Datatable instead.
    Package guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead.
    Package illuminate/html is abandoned, you should avoid using it. Use laravelcollective/html instead.
    Package league/url is abandoned, you should avoid using it. Use league/uri instead.
    Generating optimized autoload files
    > php artisan clear-compiled
    PHP Fatal error: Uncaught ReflectionException: Class LaravelCrawlerDetect does not exist in /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php:749
    Stack trace:
    #0 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(749): ReflectionClass->__construct(‘LaravelCrawlerD…’)
    #1 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(644): Illuminate\Container\Container->build(‘LaravelCrawlerD…’, Array)
    #2 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(709): Illuminate\Container\Container->make(‘LaravelCrawlerD…’, Array)
    #3 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(1203): Illuminate\Foundation\Application->make(‘LaravelCrawlerD…’)
    #4 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(175): Illuminate\Container\Container->offsetGet(‘LaravelCrawlerD…’)
    #5 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(144) in /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 749
    PHP Fatal error: Uncaught ReflectionException: Class LaravelCrawlerDetect does not exist in /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php:749
    Stack trace:
    #0 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(749): ReflectionClass->__construct(‘LaravelCrawlerD…’)
    #1 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(644): Illuminate\Container\Container->build(‘LaravelCrawlerD…’, Array)
    #2 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(709): Illuminate\Container\Container->make(‘LaravelCrawlerD…’, Array)
    #3 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php(1203): Illuminate\Foundation\Application->make(‘LaravelCrawlerD…’)
    #4 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(175): Illuminate\Container\Container->offsetGet(‘LaravelCrawlerD…’)
    #5 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(144) in /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 749
    Script php artisan clear-compiled handling the post-install-cmd event returned with error code 255

Try commenting out the references to Crawler in app/Exceptions/Handler.php

/* use Crawler;*/ in app/Exceptions/Handler.php
// if (Crawler::isCrawler()) {
// return false;
// }

dieter@yoda:/srv/ninja/code$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Package chumper/datatable is abandoned, you should avoid using it. Use OpenSkill/Datatable instead.
Package guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead.
Package illuminate/html is abandoned, you should avoid using it. Use laravelcollective/html instead.
Package league/url is abandoned, you should avoid using it. Use league/uri instead.
Generating optimized autoload files
> php artisan clear-compiled
PHP Fatal error: Uncaught Error: Call to undefined method Illuminate\Support\Facades\Session::get() in /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:237
Stack trace:
#0 /srv/ninja/code/app/Libraries/Utils.php(410): Illuminate\Support\Facades\Facade::__callStatic(‘get’, Array)
#1 /srv/ninja/code/app/Exceptions/Handler.php(78): App\Libraries\Utils::logError(’***Symfony\Comp…’)
#2 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(79): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#3 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#4 {main}
thrown in /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 237
PHP Fatal error: Uncaught Error: Call to undefined method Illuminate\Support\Facades\Session::get() in /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:237
Stack trace:
#0 /srv/ninja/code/app/Libraries/Utils.php(410): Illuminate\Support\Facades\Facade::__callStatic(‘get’, Array)
#1 /srv/ninja/code/app/Exceptions/Handler.php(78): App\Libraries\Utils::logError(’***Symfony\Comp…’)
#2 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(79): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalErrorException))
#3 /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(118): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\Debug\Exception\FatalErrorException))
#4 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
#5 {main}
thrown in /srv/ninja/code/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 237
Script php artisan clear-compiled handling the post-install-cmd event returned with error code 255

Thanks, try deleting bootstrap/cache/services.php

Thank you for your Help!

The file “bootstrap/cache/services.php” do not exist :frowning:

Maybe this will help… https://stackoverflow.com/a/37266353/497368

dieter@yoda:/srv/ninja/code$ sudo chown -R dieter:www-data /srv/ninja/code
dieter@yoda:/srv/ninja/code$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Package chumper/datatable is abandoned, you should avoid using it. Use OpenSkill/Datatable instead.
Package guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead.
Package illuminate/html is abandoned, you should avoid using it. Use laravelcollective/html instead.
Package league/url is abandoned, you should avoid using it. Use league/uri instead.
Generating optimized autoload files
> php artisan clear-compiled
The compiled class file has been removed.
> php artisan optimize
Generating optimized class loader
Compiling common classes

That seems to be a hot hint!
Thank you!

Great to hear, thanks for letting us know!

Hey! How exactly did you fix it? I did chown -R www-data:www-data on the folder, but same issue.