2

I’m attempting to get Laravel running on Google App Engine Standard. I already had it working on flexible, but requirements changed and we need standard now. I’m using the PHP 7.2 environment with Laravel 5.7. The deploy works but when trying to visit a page, I just get an error in the logs:

Symfony\Component\Debug\Exception\FatalThrowableError: Class 'Way\Generators\GeneratorsServiceProvider' not found
at Illuminate\Foundation\Application->register (/srv/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:662)

Line 662 for me locally at least is just return new $provider($this); which doesn’t seem to be explicitly referencing the generators package.

That generator package appears to be way/generators but when I do composer require way/generators locally, it spits out a million different warnings followed by

> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In GeneratorsServiceProvider.php line 58:

  Call to undefined method Illuminate\Foundation\Application::share()  


Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

From what I’ve read Laravel > 5 does not need the generators package as it already has it included but for some reason on GAE it’s trying to reference it (locally it runs fine with artisan serve). I’ve tried all sorts of composer post install commands, but nothing has helped.

"post-install-cmd": [
            "php artisan cache:clear",
            "php artisan optimize:clear",
            "php artisan config:clear",
            "php artisan config:cache",
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize",
            "chmod -R 755 bootstrap\/cache"
        ]
Alex
  • 724
  • 1
  • 9
  • 24
  • Strange! It may help to run `composer depends way/generators` to see which of your dependencies are needing it, both on GAE and locally. – 1000Nettles Feb 19 '19 at 20:21
  • @1000Nettles on both local and GAE I’m just getting back ```[InvalidArgumentException] Could not find package "way/generators" in your project```. It doesn’t seem like the library being there is the issue that’s the problem, it’s it not being there and Laravel trying to reference it – Alex Feb 19 '19 at 20:25
  • Laravel by default doesn't ship with this library which is why this is really weird. Next steps would be worth searching your codebase for `Way\Generators` and see if it somehow snuck it's way in at some point. Especially check out `config/app.php` for anything related to it. – 1000Nettles Feb 19 '19 at 20:33
  • Yeah if I was running Laravel < 5 this would make more sense but I’m not. Also yeah I tried grepping the whole thing and the package is nowhere to be found in the codebase. Oddly, I added `"way/generators": "^3.0”` to my composer.json require section and when I deployed to GAE, it actually just deployed properly and didnt spit out the call to undefined method. It installed properly and now I’m getting different error on GAE. Even more odd is it actually turned out to be a clone of way generators `xethron/migrations-generator` that something in require dev was using. Nuking that fixed it all – Alex Feb 19 '19 at 20:46
  • 1
    Glad you got it figured out. :) – 1000Nettles Feb 19 '19 at 20:49

2 Answers2

2

As you mentioned in the comments, the issue stems from using xethron/migrations-generator (https://github.com/Xethron/migrations-generator) which requires additional manual setup of service providers in either config/app.php or app/Providers/AppServiceProvider.php. The strange thing is that its composer.json does not require way/generators, but rather includes another package which also contains the files (?) for way/generators. Very strange, but explains why things are getting messy upon a composer install.

As you've done, nuking it is an option or completing the manual setup may also okay, although way/generators is for older versions of Laravel and cannot necessarily be expected to work 100%.

1000Nettles
  • 2,314
  • 3
  • 22
  • 31
0

If you are migrating to Laravel 6+ remove it and use the upgraded version of it.

composer remove --dev "xethron/migrations-generator"

If this doesn't work, then look for any ServiceProvider that integrates it into your code. Once you remove it, you can use:

composer require --dev laracasts/generators
nosoythor
  • 231
  • 2
  • 7