Composer logo. Licensed under the MIT license.

Drupal 9: Fix Composer modules prohibiting upgrade

How packages.drupal.org sets drupal/core version constraints that prevent updating to Drupal 9.

This post is also available on my blog.

{
"name": "drupal/facets_pretty_paths",
"type": "drupal-module",
"description": "Facets Pretty Paths module.",
"keywords": ["drupal"],
"license": "GPL-2.0+",
"minimum-stability": "dev",
"prefer-stable": true,
"authors": [
{
"name": "All contributors",
"homepage": "https://www.drupal.org/node/2625160/committers"
}
],
"require": {
"drupal/facets": "~1",
"drupal/pathauto": "~1"
},

"require-dev": {
"composer/installers": "^1.2",
"cweagans/composer-patches": "~1.4",
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
"drupal-composer/drupal-scaffold": "^2.2",
"drupal/admin_toolbar": "^1.24",
"drupal/coder": "^8.3",
"drupal/config_installer": "~1",
"drupal/console": "~1",
"drupal/search_api": "~1.5",
"drush/drush": "~9",
"openeuropa/drupal-core-require-dev": "~8.6@rc",
"openeuropa/task-runner": "~1.0-beta2"
},
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"autoload": {
"psr-4": {
"Drupal\\facets_pretty_paths\\": "./src"
}
},
"autoload-dev": {
"psr-4": {
"Drupal\\Tests\\facets_pretty_paths\\": "./tests/src"
}
},
"scripts": {
"drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
"post-install-cmd": "./vendor/bin/run drupal:site-setup",
"post-update-cmd": "./vendor/bin/run drupal:site-setup"
},
"extra": {
"composer-exit-on-patch-failure": true,
"enable-patching": true,
"installer-paths": {
"build/core": ["type:drupal-core"],
"build/modules/contrib/{$name}": ["type:drupal-module"],
"build/profiles/contrib/{$name}": ["type:drupal-profile"],
"build/themes/contrib/{$name}": ["type:drupal-theme"]
}
},
"config": {
"sort-packages": true
}
}
{
"name": "drupal/facets_pretty_paths",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/facets_pretty_paths.git",
"reference": "8.x-1.0"
},
"dist": {
"type": "zip",
"url": "https://ftp.drupal.org/files/projects/facets_pretty_paths-8.x-1.0.zip",
"reference": "8.x-1.0",
"shasum": "c6660cd296dd68e2f22d42337035eca65ce94ffb"
},
"require": {
"drupal/core": "~8.0",
"drupal/facets": "~1",
"drupal/pathauto": "~1"
},
"require-dev": {
"composer/installers": "^1.2",
"cweagans/composer-patches": "~1.4",
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
"drupal-composer/drupal-scaffold": "^2.2",
"drupal/admin_toolbar": "^1.24",
"drupal/coder": "^8.3",
"drupal/config_installer": "~1",
"drupal/console": "~1",
"drupal/search_api": "~1.5",
"drush/drush": "~9",
"openeuropa/drupal-core-require-dev": "~8.6@rc",
"openeuropa/task-runner": "~1.0-beta2"
},
"type": "drupal-module",
"extra": {
"branch-alias": {
"dev-1.x": "1.x-dev"
},
"drupal": {
"version": "8.x-1.0",
"datestamp": "1568102885",
"security-coverage": {
"status": "not-covered",
"message": "Project has not opted into security advisory coverage!"
}
},
"composer-exit-on-patch-failure": true,
"enable-patching": true,
"installer-paths": {
"build/core": [
"type:drupal-core"
],
"build/modules/contrib/{$name}": [
"type:drupal-module"
],
"build/profiles/contrib/{$name}": [
"type:drupal-profile"
],
"build/themes/contrib/{$name}": [
"type:drupal-theme"
]
}
},
"autoload": {
"psr-4": {
"Drupal\\facets_pretty_paths\\": "./src"
}
},
"autoload-dev": {
"psr-4": {
"Drupal\\Tests\\facets_pretty_paths\\": "./tests/src"
}
},
"notification-url": "https://packages.drupal.org/8/downloads",
"scripts": {
"drupal-scaffold": [
"DrupalComposer\\DrupalScaffold\\Plugin::scaffold"
],
"post-install-cmd": [
"./vendor/bin/run drupal:site-setup"
],
"post-update-cmd": [
"./vendor/bin/run drupal:site-setup"
]
},
"license": [
"GPL-2.0+"
],
"authors": [
{
"name": "All contributors",
"homepage": "https://www.drupal.org/node/2625160/committers"
},
{
"name": "Upchuk",
"homepage": "https://www.drupal.org/user/1885838"
},
{
"name": "dasjo",
"homepage": "https://www.drupal.org/user/228295"
}
],
"description": "Facets Pretty Paths module.",
"homepage": "https://www.drupal.org/project/facets_pretty_paths",
"keywords": [
"drupal"
],
"support": {
"source": "https://git.drupalcode.org/project/facets_pretty_paths"
}
}
name: 'Facets Pretty Paths'
type: module
description: 'Pretty paths for Facets.'
core: 8.x
package: Search
dependencies:
- facets:facets
- pathauto:pathauto
"my-author/facets_pretty_paths": {
"type": "package",
"package": {
"name": "my-author/facets_pretty_paths",
"version": "dev-6db0247",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/facets_pretty_paths.git",
"reference": "6db0247"
},
"require": {
"drupal/core": "^8.8 || ^9.0"
},
"type": "drupal-module"
}
}

Resolving issues with Drupal Console & Drush

If you use Drush

I needed to add consolidation/site-process to the Composer update statement.

Drupal Console ist not ready for Drupal 9

At the time of writing, the drupal/console library does not support Drupal 9 yet. Thus I needed to remove it.

composer remove drupal/console

Finally: Updating Drupal Core

Change the version constraint of drupal/core to ^9.0 inside the composer.json file.

composer update symfony/* symfony-cmf/* twig/twig laminas/* drupal/core

PHP Software & DevOps Engineer. Moved to https://thoeny.dev