Alex Kyriakidis
Alex Kyriakidis

Reputation: 2891

Composer removes dependencies on each deploy.

Every time Forge auto-deploys, composer removes dependencies and in order to have my site running again I have to run composer update from the command line..

Laravel Forge error:

We were unable to deploy your project to your server

Error output:

From bitbucket.org:repo/site
 * branch            master     -> FETCH_HEAD
   cc5de65..6c0428c  master     -> origin/master
Updating cc5de65..6c0428c
Fast-forward
 resources/views/home.blade.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Loading composer repositories with package information
Installing dependencies from lock file
  - Removing phpspec/phpspec (2.2.0)
  - Removing phpspec/php-diff (v1.0.2)
  - Removing phpunit/phpunit (4.6.4)
  - Removing phpunit/php-code-coverage (2.0.16)
  - Removing phpunit/php-file-iterator (1.4.0)
  - Removing phpunit/php-token-stream (1.4.1)
  - Removing phpunit/php-timer (1.0.5)
  - Removing phpunit/phpunit-mock-objects (2.3.1)
  - Removing phpunit/php-text-template (1.2.0)
  - Removing phpspec/prophecy (1.4.0)
  - Removing doctrine/instantiator (1.0.4)
  - Removing symfony/yaml (v2.6.6)
  - Removing sebastian/comparator (1.1.1)
  - Removing sebastian/diff (1.3.0)
  - Removing sebastian/environment (1.2.2)
  - Removing sebastian/exporter (1.2.0)
  - Removing sebastian/recursion-context (1.0.0)
  - Removing sebastian/global-state (1.0.0)
  - Removing sebastian/version (1.0.5)
  - Removing laracasts/generators (1.1)
Generating autoload files
PHP Fatal error:  Class 'Laracasts\Generators\GeneratorsServiceProvider' not found in /home/forge/site/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 150
PHP Stack trace:
PHP   1. {main}() /home/forge/site/artisan:0
PHP   2. Illuminate\Foundation\Console\Kernel->handle() /home/forge/site/artisan:36
PHP   3. Illuminate\Foundation\Console\Kernel->bootstrap() /home/forge/site/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:92
PHP   4. Illuminate\Foundation\Application->bootstrapWith() /home/forge/site/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:195
PHP   5. Illuminate\Foundation\Bootstrap\RegisterProviders->bootstrap() /home/forge/site/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:181
PHP   6. Illuminate\Foundation\Application->registerConfiguredProviders() /home/forge/site/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php:15
PHP   7. Illuminate\Foundation\ProviderRepository->load() /home/forge/site/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:468
PHP   8. Illuminate\Foundation\ProviderRepository->createProvider() /home/forge/site/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php:75



  [Symfony\Component\Debug\Exception\FatalErrorException]           
  Class 'Laracasts\Generators\GeneratorsServiceProvider' not found  

I have tried to remove composer.lock from .gitignore but nothing changed..

Why this may be happening??

Upvotes: 2

Views: 888

Answers (2)

Alex Kyriakidis
Alex Kyriakidis

Reputation: 2891

In order to make it work I changed Deploy script from :

cd /home/forge/site
git pull origin master
composer install --no-interaction --no-dev --prefer-dist
php artisan migrate --force

to:

cd /home/forge/site
git pull origin master
composer install --no-interaction --prefer-dist
php artisan migrate --force

Upvotes: 3

Honza Haering
Honza Haering

Reputation: 812

Yes, composer.lock should be version controlled anyway (see here). Are you sure you have actually committed the composer.lock to the bitbucket repository? Removing from .gitignore may not be sufficient if you don't add it to your commit.

Upvotes: 1

Related Questions