Class 'Dotenv\Dotenv' not found when doing composer install, fails at ACF Pro

Using Capistrano to deploy a Bedrock site, and oddly it works fine when deploying it to our Staging server. Deploying it to production for the first time however fails at installing ACF Pro, since it checks the .env for the pro key.

Composer I think is trying to install these things alphabetically? I have ACF Pro as the final entry in Composer, below Dotenv.

It can never finish my composer install because ACF always fails because it tries it before Dotenv.

Any way to set an order for these?

Here’s my composer install output…

- Updating vlucas/phpdotenv (v2.5.0 => v2.5.1): Downloading (100%)         
  - Installing johnpbloch/wordpress-core (4.9.6): Downloading (100%)         
  - Installing johnpbloch/wordpress (4.9.6): Downloading (100%)         
  - Installing oscarotero/env (v1.1.0): Downloading (100%)         
  - Installing roots/wp-password-bcrypt (1.0.0): Downloading (100%)         
  - Installing wpackagist-plugin/wp-logo-showcase-responsive-slider-slider (2.1): Downloading (100%)         
  - Installing wpackagist-plugin/mailgun ( Downloading (100%)         
  - Installing wpackagist-plugin/wp-seo-html-sitemap (0.9.6): Downloading (100%)         
  - Installing wpackagist-plugin/w3-total-cache (0.9.7): Downloading (100%)         
  - Installing wpackagist-plugin/woocommerce-all-in-one-seo-pack (1.3.4): Downloading (100%)         
  - Installing advanced-custom-fields/advanced-custom-fields-pro (5.6.10): PHP Fatal error:  Uncaught Error: Class 'Dotenv\Dotenv'

What version of Composer are you running/did you update recently? 1.7 introduced some issues that should be fixed now:

1 Like