Trellis and Acorn problem?

Hey,
It’s my first real attempt to switch to roots stack and things get kinda funky:
Trellis, Bedrock are working after battle with nfs permissions … but when I want to add Sage to the combo and install Acorn i get this:

Fatal error : Composer detected issues in your platform: Your Composer dependencies require a PHP version “>= 8.2.0”. You are running 8.1.26. in /srv/www/proreture-crm.pl/current/web/app/themes/proreture/vendor/composer/platform_check.php on line 24

Okey, cool so I install php 8.2 on Vagrant:
php -v output:
PHP 8.2.13 (cli) (built: Nov 24 2023 08:47:18) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.13, Copyright (c) Zend Technologies
with Zend OPcache v8.2.13, Copyright (c), by Zend Technologies

At this point I am more then confused. Any idea?

Are you installing Acorn 3.x?

Otherwise, will need more info to help like your composer.json if you have added any other dependencies, etc.

Yes Acorn 3.3 via cli and no other dependencies. Just installed trellis + bedrock and then sage + acorn in theme directory ( also same happened when installed acorn in bedrock directory )

  1. This composer version error occurs during deployment, on the Vagrant development system?
  2. Your PHP update to version 8.2 does not fix the composer error?
  1. I have managed to run default theme, then install sage but when I install Acorn error occurs
  2. As I have mentioned it is output of php -v after i ssh to Vagrant and still error occurs

So you are using composer CLI from your workstation against the files that are mounted from within the Vagrant VM? Then your own workstation PHP version is also relevant (see update-alternatives).

1 Like

well I have also checked my own php version and it is 8.3. At the moment I have switched to DDEV local and works properly so far so good

You can force composer to run with a specific PHP version:
https://www.cyberciti.biz/faq/how-to-tell-and-force-composer-to-use-a-specific-php-version-such-as-7-x-or-8-x/
Does it work when you force it?

This error happens when you are running composer commands from different environments that have different PHP versions

For Trellis users, it’s recommended to run all composer commands from the VM to avoid this issue

You cannot install Sage or Acorn from your host machine that is using a PHP version that doesn’t match your Trellis PHP version

3 Likes

okey, that makes sense. Thanks but would stick to ddev for now i think.

1 Like

DDEV is a good option! I’m glad you’re up and running

What exactly is meant by " For Trellis users, it’s recommended to run all composer commands from the VM"?

php -v
PHP 8.3.4 (cli) (built: Mar 12 2024 23:42:26) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.4, Copyright (c) Zend Technologies
with Zend OPcache v8.3.4, Copyright (c), by Zend Technologies

and I get this error
Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.2.0". You are running 8.1.27. in /srv/www/designerlaser.art/current/vendor/composer/platform_check.php on line 24

I have never had this issue before.

I am running a standard Trellis w/ Bedrock and the sage 10 theme with acorn installed in the site directory locally. This is happening in local developemnt.

It means exactly that. You run composer commands on your VM. Not your host machine.

Again re-iterating what I said earlier in this topic:

This error happens when you are running composer commands from different environments that have different PHP versions

When you start your local box with Trellis, it mentions the following:

==> default: Your Trellis Vagrant box is ready to use!
==> default: * Composer and WP-CLI commands need to be run on the virtual machine
==> default:   for any post-provision modifications.
==> default: * You can SSH into the machine with `vagrant ssh`.
==> default: * Then navigate to your WordPress sites at `/srv/www`
==> default:   or to your Trellis files at `/home/vagrant/trellis`.

Note:

Composer and WP-CLI commands need to be run on the virtual machine

Per your post, your local machine is running PHP 8.3. Your local dev VM is running PHP 8.1.

@ben how do I bump the VM to 8.3? And once my VM is started via trellis vm start would I be running commands on the VM when inside my theme folder and when I add acorn to my bedrock folder (site)?

how do I bump the VM to 8.3?

Can you create a new topic? This one is solved and upgrading the PHP version in Trellis is not related to this issue

I’d also urge you to search the forum and Trellis repo since there’s many existing examples/discussions about changing PHP versions

would I be running commands on the VM when inside my theme folder and when I add acorn to my bedrock folder (site)

Is it a composer command? Then the answer is yes…