Class 'Dotenv\Dotenv' not found

When trying to deploy to the staging server with ./bin/ staging i’m getting an uncaught error that Dotenv\Dotenv is not found, along with some complaining that unzip is not installed.

I updated Trellis to the latest version to see if there was a fix, but the error continues. I’m running Composer version 1.6.5 2018-05-04 11:44:59

Any ideas how I could proceed?

I see a similar issue which was related to an older version of Composer, which is reported as fixed, along with another issue raised today, but I didn’t want to hijack it as I’m not sure if these are the same problems.

Also, how/should I go about installing unzip?

Many thanks, as always!

Loading composer repositories with package information Installing
dependencies from lock file Package operations: 8 installs, 1 update, 0
removals - Updating vlucas/phpdotenv (v2.4.0 => v2.5.1): As there is no
'unzip' command installed zip files are being unpacked using the PHP zip
extension. This may cause invalid reports of corrupted archives. Installing
'unzip' may remediate them. Loading from cache - Installing advanced-custom-
fields/advanced-custom-fields-pro (5.7.2): PHP Fatal error: Uncaught Error:
Class 'Dotenv\Dotenv' not found in /srv/www/

I fixed this by updating Composer to the latest snapshot by running composer self-update --snapshot, then following the steps outlined here and reprovisioning.

This is taken from the comment linked above:

composer self-update --snapshot

ssh into your virtual machine with vagrant ssh

remove or rename sudo rm /usr/local/bin/composer

log out of the virtual machine exit

run ANSIBLE_TAGS=composer vagrant provision from inside trellis directory to reprovision composer.