Cannot installl rainlab.blog - GithubActionError

I’m running octobercms 2.1.27 (PHP 8.0.6) in a docker container. When running the cli command to install the blog package:

php artisan plugin:install rainlab.blog

I am getting the following error at the end:

97/99 [===========================>] 97%
98/99 [===========================>] 98%
99/99 [============================] 100%PHP Fatal error: Uncaught Error: Call to undefined method Composer\Util\Platform::getEnv() in /var/www/vendor/composer/composer/src/Composer/Console/GithubActionError.php:39
Stack trace:
#0 /var/www/vendor/composer/composer/src/Composer/Console/Application.php(345): Composer\Console\GithubActionError->emit(‘file_get_conten…’)
#1 /var/www/vendor/symfony/console/Application.php(149): Composer\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 /var/www/vendor/composer/composer/src/Composer/Console/Application.php(128): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /var/www/vendor/composer/composer/bin/composer(74): Composer\Console\Application->run()
#4 {main}
thrown in /var/www/vendor/composer/composer/src/Composer/Console/GithubActionError.php on line 39

Fatal error: Uncaught Error: Call to undefined method Composer\Util\Platform::getEnv() in /var/www/vendor/composer/composer/src/Composer/Console/GithubActionError.php:39
Stack trace:
#0 /var/www/vendor/composer/composer/src/Composer/Console/Application.php(345): Composer\Console\GithubActionError->emit(‘file_get_conten…’)

I have checked and my .env file is in the container.

Any help much appreciated.

PS: Does anyone know of the blogging package uses the DB for blog content? (or is it file-based, as with the cms content by default?) I am looking for DB-driven blog package

Hey @gvanto

What version of composer are you using?

Regarding the RainLab.Blog plugin, it stores the content in the database. If you install v3, the demo theme includes an equivalent set of blog blueprints that offer the same functionality; also storing the content in the database.

Hi @daft

I’m using composer 2.
Wondering if its looking for GH auth details …?

Ok thanks very much for the info about the db, that’s perfect.

Actually, if I remember correctly. This composer error is kind of specific, it occurs when composer is loaded in a partial state.

Here’s how it happens. Let’s assume we start with composer v2.6.4:

  1. Composer runs, and loads some files into memory
  2. Composer updates to v2.7.1 during this process
  3. The composer filesystem has now changed and composer is in a corrupt state
  4. Composer is looking for a method (autoloaded file) in 2.6.4, but its now gone

This is why you see the Composer\Util\Platform::getEnv() missing method error. Composer is unique because each version has a completely new location, it doesn’t overwrite itself or anything like this, but it also doesn’t keep its old version around.

The trick to solving this is to run two processes:

  1. Update composer first
  2. Update the rest of the application

I hope this helps.

1 Like

Thanks so much @daft, that worked!