What does your composer.json file look like?
Help with laravel Forge and Way Generators Error
When I run composer install I get the following error. I think it is from an artisan command that is running after the composer install. Artisan thinks it is running on a local env. In my deploy script I have to add the --env="production" flag at the end of artisan commands or I get this error there too. In my config/local/app.php I have the WayGeneratorsServiceProvider referenced, but in config/app.php it is not referenced. What do I need to do to get this error to stop showing up?
forge@Quickernotes:~/quickernotes.com$ composer install --no-dev -vvv
Reading ./composer.json
Loading config file ./composer.json
Executing command (CWD): git describe --exact-match --tags
Executing command (CWD): git branch --no-color --no-abbrev -v
Failed to initialize global composer: Composer could not find the config file: /home/forge/.composer/composer.json
To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section
Reading ./composer.lock
Loading composer repositories with package information
Installing dependencies from lock file
Reading ./composer.lock
Nothing to install or update
Generating autoload files
Executing command (CWD): php artisan optimize
PHP Fatal error: Class 'Way\Generators\GeneratorsServiceProvider' not found in /home/forge/quickernotes.com/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 157
PHP Stack trace:
PHP 1. {main}() /home/forge/quickernotes.com/artisan:0
PHP 2. require_once() /home/forge/quickernotes.com/artisan:30
PHP 3. require() /home/forge/quickernotes.com/bootstrap/start.php:58
PHP 4. Illuminate\Foundation\ProviderRepository->load() /home/forge/quickernotes.com/vendor/laravel/framework/src/Illuminate/Foundation/start.php:210
PHP 5. Illuminate\Foundation\ProviderRepository->compileManifest() /home/forge/quickernotes.com/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php:57
PHP 6. Illuminate\Foundation\ProviderRepository->createProvider() /home/forge/quickernotes.com/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php:121
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'Way\\Generators\\GeneratorsServiceProvider' not found","file":"\/home\/forge\/quickernotes.com\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/ProviderRepository.php","line":157}}Script php artisan optimize handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output: PHP Fatal error: Class 'Way\Generators\GeneratorsServiceProvider' not found in /home/forge/quickernotes.com/vendor/laravel/framework/src/Illuminate/F
oundation/ProviderRepository.php on line 157
PHP Stack trace:
PHP 1. {main}() /home/forge/quickernotes.com/artisan:0
PHP 2. require_once() /home/forge/quickernotes.com/artisan:30
PHP 3. require() /home/forge/quickernotes.com/bootstrap/start.php:58
PHP 4. Illuminate\Foundation\ProviderRepository->load() /home/forge/quickernotes.com/vendor/laravel/framework/src/Illuminate/Foundation/start.php:210
PHP 5. Illuminate\Foundation\ProviderRepository->compileManifest() /home/forge/quickernotes.com/vendor/laravel/framework/src/Illuminate/Foundation/ProviderReposit
ory.php:57
PHP 6. Illuminate\Foundation\ProviderRepository->createProvider() /home/forge/quickernotes.com/vendor/laravel/framework/src/Illuminate/Foundation/ProviderReposito
ry.php:121
Exception trace:
() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:185
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:120
Composer\EventDispatcher\EventDispatcher->dispatchCommandEvent() at phar:///usr/local/bin/composer/src/Composer/Installer.php:336
Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:127
Composer\Command\InstallCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:252
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:874
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:146
Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:83
Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:43
require() at /usr/local/bin/composer:25
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [packages1] ... [packagesN]
So in my Forge deploy script I set composer install --no-dev --no-scripts then I do php artisan optimize --env="production". That seems to have solved the problem. Can't believe it was that simple.
There must be a way to let Artisan know that it is in production mode other than the --env flag.
Here is my Forge deployment script:
cd /home/forge/myapp.com
git pull origin master
composer install --no-dev --no-scripts
php artisan optimize --env="production"
php artisan migrate --force --env="production"
Please or to participate in this conversation.