Roots Discourse

Trellis 1.7.0 with Composer 1.x

I already use Trellis v1.4.0 on a different server. Last month after the Composer 2.0 release, I found out what settings to apply to force Composer 1.x to be installed instead.

I’m now setting up a new server and thought I’d use the latest version of Trellis etc. I still need Composer 1.x so I presumed the changes I made on my Trellis 1.4.0 would work for this version too, however Composer v2 is always installed.

trellis/group_vars/all/main.yml

composer_keep_updated: false
composer_version: '1.10.16'
composer_global_packages:
- { name: hirak/prestissimo }

/trellis/dev.yml

- { role: composer, tags: [composer], composer_version: '1.10.16', composer_keep_updated: false }

/trellis/server.yml

- { role: composer, tags: [composer], composer_version: '1.10.16', composer_keep_updated: false }

vagrant reload --provision

/trellis -> vagrant ssh -> composer --version = Composer version 2.0.8

Yeah had that too the other day; did you apply that composer settings after your first vagrant up? In that case a good old vagrant destroy & vagrant up worked for me!

Sorry should have confirmed I had also tried a vagrant destroy & vagrant up.

The vagrant up gets to this point and fails:

Based on the error. I presumed the error is because composer 2.x is being installed, and as above I have re-introduced the hirak/prestissimo package. However I am trying not to install Composer 2.x in the first place.

You don’t need the composer_global_packages line anymore either, see this topic: Hirak/prestissimo at version @stable has an incompatible requirement

I thought that line was needed if you’re forcing composer v1 to be installed.

Composer v2 comes with the feature which hirak/prestissimo provided and that’s why it was originally removed? Anyway, let me remove that and destroy/provision again and I’ll respond with how it goes.

The vagrant up worked after removing the line @Twansparant mentioned, however composer v2.0.8 was still installed.

Really? That’s… weird? Did you check that in the box with vagrant ssh?

Yep strange one.

vagrant ssh -> composer --version
Screenshot 2020-12-11 at 20.13.16

Actually I have a project up and running with Trellis 1.7.0 with just this in the main.yml:

composer_keep_updated: true

On my host I’m still on Composer 1.10.15 and the vagrant box is on version 2.0.7.
Seems to work just fine?

To confirm, if you ‘vagrant ssh’ and then ‘composer --version’ you have 2.0.7?

My MacBook itself has v1.x installed, but inside of the vagrant box is composer V2.

Confirmed!

Same here yes!

This topic was automatically closed after 42 days. New replies are no longer allowed.