Roots Discourse

Issues with Composer, Dotenv, ffraenz/private-composer-installer

Running “composer update” works just fine locally, but when I deploy, I keep getting this message. I’ve tried deleting the folders named “vendor” and “plugins”, and deleted the composer.lock file. Does anyone have any ideas? I am stumped.

TASK [deploy : Install Composer dependencies] *******************************************************************************************************************************************************************************************
System info:
  Ansible 2.8.0; Darwin
  Trellis Head
---------------------------------------------------
Loading composer repositories with package information Installing
dependencies from lock file Package operations: 19 installs, 6 updates, 0
removals - Updating composer/installers (v1.7.0 => v1.8.0): Loading from
cache - Updating symfony/polyfill-ctype (v1.13.1 => v1.14.0): Loading from
cache - Updating vlucas/phpdotenv (v3.6.0 => v4.1.0): Loading from cache -

Updating ffraenz/private-composer-installer (v2.0.0 => v4.0.0): Loading from
cache - Updating symfony/options-resolver (v4.4.2 => v4.4.4): Loading from
cache - Updating webmozart/assert (1.6.0 => 1.7.0): Loading from cache -
Installing advanced-custom-fields/advanced-custom-fields-pro (5.8.7): PHP
Fatal error: Uncaught TypeError: Argument 1 passed to Dotenv\Dotenv::create()
must be an instance of Dotenv\Repository\RepositoryInterface, string given,
called in
/srv/www/mysite.com/releases/20200225170156/vendor/ffraenz
/private-composer-installer/src/PrivateComposerInstaller/Plugin.php on line
143 and defined in /srv/www/mysite.com/releases/20200225170156/
vendor/vlucas/phpdotenv/src/Dotenv.php:62 Stack trace: #0
/srv/www/mysite.com/releases/20200225170156/vendor/ffraenz
/private-composer-installer/src/PrivateComposerInstaller/Plugin.php(143):
Dotenv\Dotenv::create('/srv/www/dorman...') #1
/srv/www/mysite.com/releases/20200225170156/vendor/ffraenz
/private-composer-installer/src/PrivateComposerInstaller/Plugin.php(98):
FFraenz\PrivateComposerInstaller\Plugin->getEnv('ACF_PRO_KEY') #2 [internal
function]: FFraenz\PrivateComposerInstaller\Plugin->injectPlaceholders(Object
(Composer\Plugin\PreFileDownloadEvent)) #3
phar:///usr/local/bin/composer/src/Composer/EventDispatc in /srv/www/dormanho
meremodeling.com/releases/20200225170156/vendor/vlucas/phpdotenv/src/Dotenv.p
hp on line 62

Here’s my solution for now:

  1. SSH into webserver
  2. CD into /srv/www/yoursite.com/current/vendor
  3. rename/delete ffraenz to something else
  4. rename/delete vlucas to something else

After that, I was able to deploy as usual.