Closed patrickmceldowney closed 3 years ago
I have the same error when attempting a Trellis deploy. Here is the text:
TASK [deploy : Install Composer dependencies] ********************************************
System info:
Ansible 2.9.12; Darwin
---------------------------------------------------
Loading composer repositories with package information Installing
dependencies from lock file Package operations: 20 installs, 1 update, 0
removals - Updating ffraenz/private-composer-installer (v4.0.0 => v5.0.1):
Loading from cache - Installing advanced-custom-fields/advanced-custom-
fields-pro (5.9.1): PHP Fatal error: Uncaught Error: Class
'FFraenz\PrivateComposerInstaller\Exception\MissingEnvException' not found in
/srv/www/www.mitcnc.org/releases/20201101193115/vendor/ffraenz/private-
composer-installer/src/PrivateComposerInstaller/Env.php:91 Stack trace: #0 /s
rv/www/www.mitcnc.org/releases/20201101193115/vendor/phpoption/phpoption/src/
PhpOption/None.php(50): FFraenz\PrivateComposerInstaller\Env->FFraenz\Private
ComposerInstaller\{closure}() #1
/srv/www/www.mitcnc.org/releases/20201101193115/vendor/ffraenz/private-
composer-installer/src/PrivateComposerInstaller/Env.php(92):
PhpOption\None->getOrCall() #2 /srv/www/www.mitcnc.org/releases/2020110119311
5/vendor/phpoption/phpoption/src/PhpOption/None.php(50): FFraenz\PrivateCompo
serInstaller\Env->FFraenz\PrivateComposerInstaller\{closure}() #3
/srv/www/www.mitcnc.org/releases/20201101193115/vendor/ffraenz/private-
composer-installer/src/PrivateComposerInstaller/Env.php(93):
PhpOption\None->getOrCall() #4
/srv/www/www.mitcnc.org/releases/20201101193115/vendor/ffraenz/private-com in
/srv/www/www.mitcnc.org/releases/20201101193115/vendor/ffraenz/private-
composer-installer/src/PrivateComposerInstaller/Env.php on line 91
fatal: [staging.mitcnc.org]: FAILED! => {"changed": false, "stdout": "Loading composer repositories with package information\nInstalling dependencies from lock file\nPackage operations: 20 installs, 1 update, 0 removals\n - Updating ffraenz/private-composer-installer (v4.0.0 => v5.0.1): Loading from cache\n - Installing advanced-custom-fields/advanced-custom-fields-pro (5.9.1): PHP Fatal error: Uncaught Error: Class 'FFraenz\\PrivateComposerInstaller\\Exception\\MissingEnvException' not found in /srv/www/www.mitcnc.org/releases/20201101193115/vendor/ffraenz/private-composer-installer/src/PrivateComposerInstaller/Env.php:91\nStack trace:\n#0 /srv/www/www.mitcnc.org/releases/20201101193115/vendor/phpoption/phpoption/src/PhpOption/None.php(50): FFraenz\\PrivateComposerInstaller\\Env->FFraenz\\PrivateComposerInstaller\\{closure}()\n#1 /srv/www/www.mitcnc.org/releases/20201101193115/vendor/ffraenz/private-composer-installer/src/PrivateComposerInstaller/Env.php(92): PhpOption\\None->getOrCall()\n#2 /srv/www/www.mitcnc.org/releases/20201101193115/vendor/phpoption/phpoption/src/PhpOption/None.php(50): FFraenz\\PrivateComposerInstaller\\Env->FFraenz\\PrivateComposerInstaller\\{closure}()\n#3 /srv/www/www.mitcnc.org/releases/20201101193115/vendor/ffraenz/private-composer-installer/src/PrivateComposerInstaller/Env.php(93): PhpOption\\None->getOrCall()\n#4 /srv/www/www.mitcnc.org/releases/20201101193115/vendor/ffraenz/private-com in /srv/www/www.mitcnc.org/releases/20201101193115/vendor/ffraenz/private-composer-installer/src/PrivateComposerInstaller/Env.php on line 91\n", "stdout_lines": ["Loading composer repositories with package information", "Installing dependencies from lock file", "Package operations: 20 installs, 1 update, 0 removals", " - Updating ffraenz/private-composer-installer (v4.0.0 => v5.0.1): Loading from cache", " - Installing advanced-custom-fields/advanced-custom-fields-pro (5.9.1): PHP Fatal error: Uncaught Error: Class 'FFraenz\\PrivateComposerInstaller\\Exception\\MissingEnvException' not found in /srv/www/www.mitcnc.org/releases/20201101193115/vendor/ffraenz/private-composer-installer/src/PrivateComposerInstaller/Env.php:91", "Stack trace:", "#0 /srv/www/www.mitcnc.org/releases/20201101193115/vendor/phpoption/phpoption/src/PhpOption/None.php(50): FFraenz\\PrivateComposerInstaller\\Env->FFraenz\\PrivateComposerInstaller\\{closure}()", "#1 /srv/www/www.mitcnc.org/releases/20201101193115/vendor/ffraenz/private-composer-installer/src/PrivateComposerInstaller/Env.php(92): PhpOption\\None->getOrCall()", "#2 /srv/www/www.mitcnc.org/releases/20201101193115/vendor/phpoption/phpoption/src/PhpOption/None.php(50): FFraenz\\PrivateComposerInstaller\\Env->FFraenz\\PrivateComposerInstaller\\{closure}()", "#3 /srv/www/www.mitcnc.org/releases/20201101193115/vendor/ffraenz/private-composer-installer/src/PrivateComposerInstaller/Env.php(93): PhpOption\\None->getOrCall()", "#4 /srv/www/www.mitcnc.org/releases/20201101193115/vendor/ffraenz/private-com in /srv/www/www.mitcnc.org/releases/20201101193115/vendor/ffraenz/private-composer-installer/src/PrivateComposerInstaller/Env.php on line 91"]}
Isn't ffraenz/private-composer-installer
globally installed??
Yes. I rolled back composer versions and have gone on to my production server and updated those composer packages directly instead of through a deployment. This seems to have fixed that error and I'll be moving back to composer 2 to test it out.
I am now getting a Can't resolve placeholder {%version}. Environment variable 'version' is not set
when I deploy but that is probably a separate issue
@patrickmceldowney This may be an issue occurring when downgrading Composer versions. In Composer 2 the version placeholder no longer gets replaced in composer.lock
while in Composer 1 the version is required to be set in composer.lock
due to API restrictions. You may manually replace the version placeholder in composer.lock
to fix this specific issue.
I encountered issues when upgrading private-composer-installer
or phpdotenv
while also running the former to e.g. upgrade ACF Pro. Composer seems to be unable to replace a library already loaded into memory by a new version. I don't think I can influence that with a patch. I'd suggest to first upgrade private-composer-installer
, then phpdotenv
and finally ACF Pro using either Composer 1 or Composer 2.
interesting. yup, I started to do them one by one and I haven't run into any issues yet. I'm sticking with composer 1 for now so I can get some work pushed up and may look back into later this week. Thanks for the input!
After updating composer to v2 I got a bunch of errors when running
composer update
, but those were resolved when I updated the version of this installer to ^5.0. Today I'm running into a new error after the 5.0.1 update.and here's the console output