Ana

Lando + Composer FTW

I feel I'm having one of those "DUH! Of course!" moments right now.

I've been doing updates for years, and cursing every time this happened to me. I have to run a simple command: composer update drupal/core "drupal/core-*" --with-all-dependencies

We work locally with lando, and use composer within lando as well, so the command would change to: lando composer ...

So far so good, worked very well.

But sometimes, the dreadful message came:

Your requirements could not be resolved to an installable set of packages.
Problem I
Some package is locked and an update was not requested
Some package requires another package, but it conflicts with another require
Bash

Wait, what? Why?

And it finished with...

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Bash

But why?! I used it, is it playing with me? Is this script bullying me?

Well, no. I realized today, that using Composer within Lando can be confusing for the script sometimes.

Somehow, the --with-all-dependencies flag was ignored.

The fix is easy. We just need to make sure that the command gets separated, and everything after composer is treated as an argument for Composer, and not Lando.

Just add a double dash. Like this:

lando composer update -- drupal/core "drupal/core-*" --with-all-dependencies
Bash

This is a command line thing. Everything after the double dash is an argument for composer update, and that's it. It worked. It worked so smoothly I felt like I had seen the stars in the meme.

Hope this is useful to you as well.

Related blog posts

Pantheon Discord Webhook Integration

Pantheon Quicksilver script to send notifications to Discord

Entity queues blogpost banner

Hand-picked content at the top of a chronologically sorted view: Option 2, Entity queues

Following the one way or another series we’ll solve the problem of overriding the default order of a view with hand picked contents through Entity queues.

Bright pink sticky note with a smiley face

Hand-picked content at the top of a chronologically sorted view: Option 1, make it Sticky!

This is the first of the One way or another series. A set of blog posts where we explore different ways to implement similar features. Our topic today is: Sticky content on top of lists!