overcome Drupal 9 composer update symfony version conflict - symfony

I'm trying update Drupal 9, but composer is failing on symfony/var-dumper or symfony/cache versions.
$ composer update
For additional security you should declare the allow-plugins config with a list of packages names that are allowed to run code. See https://getcomposer.org/allow-plugins
This warning will become an exception once you run composer update!
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires drupal/core-dev 9.3.0 -> satisfiable by drupal/core-dev[9.3.0].
- You can only install one version of a package, so only one of these can be installed: symfony/var-dumper[v3.4.0, ..., v3.4.47, v4.0.0, ..., v4.4.42, v5.0.0, ..., v5.4.9, v6.0.0, ..., v6.1.0].
- drupal/core-recommended 9.0.0 requires symfony/var-dumper v5.1.0 -> satisfiable by symfony/var-dumper[v5.1.0].
- drupal/core-dev 9.3.0 requires symfony/var-dumper ^5.4 -> satisfiable by symfony/var-dumper[v5.4.0, ..., v5.4.9].
- Root composer.json requires drupal/core-recommended 9 -> satisfiable by drupal/core-recommended[9.0.0].
I had been trying to update OwlCarousel, which won't work. I noticed I had the 1.x version installed, so I removed it and then tried to add owlcarousel2. But with no luck. I tried with setting minimum-stability to both dev and stable, specifying just drupal/owlcarousel2 and 'drupal/owlcarousel:^2.0#RC'
Composer gives me:
$ composer require drupal/owlcarousel2
Using version ^1.0#RC for drupal/owlcarousel2
./composer.json has been updated
Running composer update drupal/owlcarousel2
Loading composer repositories with package information
Updating dependencies
Info from https://repo.packagist.org: #StandWithUkraine
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires drupal/owlcarousel2 ^1.0#RC -> satisfiable by drupal/owlcarousel2[1.0.0-rc1].
- drupal/owlcarousel2 1.0.0-rc1 requires drupal/core ~8.0 -> found drupal/core[8.0.0-beta6, ..., 8.9.x-dev] but the package is fixed to 9.3.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
What happens when I just try composer update ...
Problem 1
- drupal/core 8.0.0-beta6 requires doctrine/common dev-master#a45d110f71c323e29f41eb0696fa230e3fa1b1b5 -> found doctrine/common[2.1.3, ..., 2.13.x-dev, 3.0.0, ..., 3.3.x-dev] but it does not match the constraint.
- Root composer.json requires drupal/core-recommended 9.3.0 -> satisfiable by drupal/core-recommended[9.3.0].
- drupal/owlcarousel2 1.0.0-rc1 requires drupal/core ~8.0 -> satisfiable by drupal/core[8.0.0-beta6, ..., 8.9.x-dev].
...
I have no idea why drupal 8.* is being mention here. "drupal/core 8.0.0-beta6..." -- I painstakingly rebiult from scratch on 9.x (I used to love working with drupal but now it's the bane of my existence.)
I troll the web looking for similar problems to mine, and run randomly found commands like this one:
composer require 'drupal/core-recommended:9' 'drupal/core-composer-scaffold:9' 'drupal/core-project-message:9' --update-with-dependencies --no-update
533 composer update --with-all-dependencies
Now there's no mention of drupal 8.* in the output, but I still can't install Owlcarousel2 or run composer update.
Honestly, I feel composer and drupal together is a failure. I've been using composer for ~3+ years on this codebase, but to get it from 8.9 to 9.x I had to completely toss it and restart from the ground up on drupal/core-recommened 9.x. And even then, after installing ~10-12 modules I find myself here again--with composer just about never running successfully, and I spend a WEEK mucking with it to no avail.
Where was I...
$ composer why symfony/var-dumper
For additional security you should declare the allow-plugins config with a list of packages names that are allowed to run code. See https://getcomposer.org/allow-plugins
This warning will become an exception once you run composer update!
drupal/core-dev 9.3.0 requires symfony/var-dumper (^5.4)
drupal/core-recommended 9.3.0 requires symfony/var-dumper (v5.4.0)
drush/drush 11.0.9 requires symfony/var-dumper (^4.0 || ^5.0 || ^6.0)
psy/psysh v0.11.4 requires symfony/var-dumper (^6.0 || ^5.0 || ^4.0 || ^3.4)
symfony/cache v5.4.8 conflicts symfony/var-dumper (<4.4)
symfony/error-handler v4.4.34 requires symfony/var-dumper (^4.4|^5.0)
So is symfony/cache the problem?
In composer.lock I find the symfony framework-bundle section:
{
"name": "symfony/framework-bundle",
"version": "v4.4.37",
"source": {
"type": "git",
"url": "https://github.com/symfony/framework-bundle.git",
"reference": "5ae3655a69ac8b6a7bf46ce2b1e04b7be2ec05c7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/framework-bundle/zipball/5ae3655a69ac8b6a7bf46ce2b1e04b7be2ec05c7",
"reference": "5ae3655a69ac8b6a7bf46ce2b1e04b7be2ec05c7",
"shasum": ""
},
"require": {
"ext-xml": "*",
"php": ">=7.1.3",
"symfony/cache": "^4.4|^5.0",
"symfony/config": "^4.4.11|~5.0.11|^5.1.3",
"symfony/dependency-injection": "^4.4.1|^5.0.1",
"symfony/error-handler": "^4.4.1|^5.0.1",
"symfony/filesystem": "^3.4|^4.0|^5.0",
"symfony/finder": "^3.4|^4.0|^5.0",
"symfony/http-foundation": "^4.4|^5.0",
"symfony/http-kernel": "^4.4",
"symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php80": "^1.16",
"symfony/routing": "^4.4.12|^5.1.4"
},
"conflict": {
"doctrine/persistence": "<1.3",
"phpdocumentor/reflection-docblock": "<3.0|>=3.2.0,<3.2.2",
"phpdocumentor/type-resolver": "<0.3.0|1.3.*",
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0",
"symfony/asset": "<3.4",
"symfony/browser-kit": "<4.3",
"symfony/console": "<4.4.21",
"symfony/dom-crawler": "<4.3",
"symfony/dotenv": "<4.3.6",
"symfony/form": "<4.3.5",
"symfony/http-client": "<4.4",
"symfony/lock": "<4.4",
"symfony/mailer": "<4.4",
"symfony/messenger": "<4.4",
"symfony/mime": "<4.4",
"symfony/property-info": "<3.4",
"symfony/security-bundle": "<4.4",
"symfony/serializer": "<4.4",
"symfony/stopwatch": "<3.4",
"symfony/translation": "<4.4",
"symfony/twig-bridge": "<4.1.1",
"symfony/twig-bundle": "<4.4",
"symfony/validator": "<4.4",
"symfony/web-profiler-bundle": "<4.4",
"symfony/workflow": "<4.3.6"
},
I've been trying to build in the most mainstream way, so as to avoid these dependency issues.
In some threads I see people ask "Why do you have drupal/core-dev ? Other threads respond that it's a requirement for drupal/core-recommended.
Some say "delete your composer.json, composer.lock, symfomny.lock, and/or vendor folder." Huh?! I have stuff in vendor that I'd have to copy out and save, then replace, etc. Is this really a solution? Doesn't composer.json store what's installed?
I'd appreciate any advice on fixing this install.
Also, how can I use drupal and composer and not have to cross my fingers and hold my EVERY TIME I run updates or have to add a module?
composer.json:
{
"name": "drupal/recommended-project",
"description": "Project template for Drupal 9 projects with a relocated document root",
"type": "project",
"license": "GPL-2.0-or-later",
"homepage": "https://www.drupal.org/project/drupal",
"support": {
"docs": "https://www.drupal.org/docs/user_guide/en/index.html",
"chat": "https://www.drupal.org/node/314178"
},
"repositories": {
"0": {
"type": "composer",
"url": "https://packages.drupal.org/8"
},
"owlcarousel2": {
"type": "package",
"package": {
"name": "owlcarousel2/owlcarousel2",
"version": "2.3.4",
"type": "drupal-library",
"dist": {
"type": "zip",
"url": "https://github.com/OwlCarousel2/OwlCarousel2/archive/2.3.4.zip"
}
}
},
"tiny_slider": {
"type": "package",
"package": {
"name": "ganlanyuan/tiny-slider",
"version": "2.9.3",
"type": "drupal-library",
"dist": {
"type": "zip",
"url": "https://github.com/ganlanyuan/tiny-slider/archive/refs/tags/v2.9.3.zip"
}
}
}
},
"require": {
"composer/installers": "^1.9",
"drupal/admin_theme": "^1.0#beta",
"drupal/aegan": "1.1",
"drupal/at_tools": "^3.3",
"drupal/backup_migrate": "^5.0",
"drupal/better_search": "^1.6",
"drupal/blazy": "^2.11",
"drupal/blazy_ui": "^2.11",
"drupal/ckeditor_config": "^3.1",
"drupal/ckeditor_div_manager": "^2.0",
"drupal/ckeditor_video": "1.x-dev",
"drupal/core-composer-scaffold": "9",
"drupal/core-dev": "9.3.0",
"drupal/core-project-message": "9",
"drupal/core-recommended": "9",
"drupal/ctools": "^3.7",
"drupal/editor_advanced_link": "1.9",
"drupal/entity": "^1.3",
"drupal/entity_clone": "^1.0#beta",
"drupal/exclude_node_title": "^1.3",
"drupal/externalauth": "1.4",
"drupal/fakeobjects": "^1.1",
"drupal/imce": "^2.4",
"drupal/jira_issue_collector": "^1.2",
"drupal/juicebox": "3.0.0-alpha2",
"drupal/libraries": "^3.0#beta",
"drupal/menu_item_role_access": "^2.0",
"drupal/node_class": "^2.0",
"drupal/nodeaccess": "^1.1",
"drupal/owlcarousel2": "^1.0#RC",
"drupal/pathauto": "^1.10",
"drupal/profile": "^1.4",
"drupal/simplesamlphp_auth": "^3.2",
"drupal/slick": "2.6",
"drupal/slick_extras": "1.0-rc7",
"drupal/slick_views": "^2.6",
"drupal/svg_image": "1.16",
"drupal/tiny_slider": "^1.0#beta",
"drupal/token": "^1.10",
"drupal/vapn": "^1.5",
"drupal/views_accordion": "^2.0",
"drupal/views_slideshow": "4.8",
"drush/drush": "^11.0"
},
"require-dev": {},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true
},
"extra": {
"drupal-scaffold": {
"locations": {
"web-root": "./"
}
},
"installer-paths": {
"core": [
"type:drupal-core"
],
"libraries/{$name}": [
"type:drupal-library"
],
"modules/contrib/{$name}": [
"type:drupal-module"
],
"profiles/contrib/{$name}": [
"type:drupal-profile"
],
"themes/contrib/{$name}": [
"type:drupal-theme"
],
"drush/Commands/contrib/{$name}": [
"type:drupal-drush"
],
"modules/custom/{$name}": [
"type:drupal-custom-module"
],
"profiles/custom/{$name}": [
"type:drupal-custom-profile"
],
"themes/custom/{$name}": [
"type:drupal-custom-theme"
]
},
"drupal-core-project-message": {
"include-keys": [
"homepage",
"support"
],
"post-create-project-cmd-message": [
"<bg=blue;fg=white> </>",
"<bg=blue;fg=white> Congratulations, you’ve installed the Drupal codebase </>",
"<bg=blue;fg=white> from the drupal/recommended-project template! </>",
"<bg=blue;fg=white> </>",
"",
"<bg=yellow;fg=black>Next steps</>:",
" * Install the site: https://www.drupal.org/docs/8/install",
" * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
" * Get support: https://www.drupal.org/support",
" * Get involved with the Drupal community:",
" https://www.drupal.org/getting-involved",
" * Remove the plugin that prints this message:",
" composer remove drupal/core-project-message"
]
}
}
}

Related

"requirements could not be resolved to an installable set of packages" when I try to create a web app symfony 6 project

When I try to create a web app symfony 6 project, I have this error message :"Your requirements could not be resolved to an installable set of packages" and dependencies seems not to be installed (Lot of folders in my project are missing).
MacBook-Pro-de-Ludovic:programmation lesage$ symfony new --webapp projetWeb
Creating a new Symfony project with Composer
(running /Users/lesage/Documents/ludovic/programmation/composer.phar create-project symfony/skeleton /Users/lesage/Documents/ludovic/programmation/projetWeb --no-interaction)
Setting up the project under Git version control
(running git init /Users/lesage/Documents/ludovic/programmation/projetWeb)
(running /Users/lesage/Documents/ludovic/programmation/composer.phar require webapp --no-interaction)
./composer.json has been updated
Running composer update symfony/webapp-pack
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "6.2.*"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- symfony/webapp-pack[v1.0.0, ..., v1.1.1] require symfony/orm-pack * -> satisfiable by symfony/orm-pack[v1.0.0, ..., v1.2.0, v2.0.0, v2.1.0, v2.2.0, v2.3.0].
- symfony/orm-pack[v1.0.8, v2.0.0, ..., v2.3.0] require doctrine/doctrine-migrations-bundle * -> satisfiable by doctrine/doctrine-migrations-bundle[1.0.0, ..., v1.3.2, v2.0.0, ..., 2.2.3, 3.0.0, ..., 3.2.2].
- symfony/orm-pack[v2.1.0, ..., v2.2.0] require symfony/proxy-manager-bridge * -> satisfiable by symfony/proxy-manager-bridge[v6.2.0].
- doctrine/doctrine-migrations-bundle[3.2.1, ..., 3.2.2] require doctrine/migrations ^3.2 -> satisfiable by doctrine/migrations[3.2.0, ..., 3.5.4].
- symfony/proxy-manager-bridge v6.2.0 requires friendsofphp/proxy-manager-lts ^1.0.2 -> satisfiable by friendsofphp/proxy-manager-lts[v1.0.2, ..., v1.0.13].
- doctrine/migrations[3.3.1, ..., 3.5.4] require friendsofphp/proxy-manager-lts ^1.0 -> satisfiable by friendsofphp/proxy-manager-lts[v1.0.0, ..., v1.0.13].
- friendsofphp/proxy-manager-lts[v1.0.4, ..., v1.0.13] require laminas/laminas-code ~3.4.1|^4.0 -> satisfiable by laminas/laminas-code[3.4.1, 4.0.0, ..., 4.8.0].
- symfony/orm-pack[v1.1.0, ..., v1.2.0] require doctrine/doctrine-migrations-bundle ^2 -> satisfiable by doctrine/doctrine-migrations-bundle[v2.0.0, ..., 2.2.3].
- laminas/laminas-code 3.4.1 requires php ^7.1 -> your php version (8.3.0-dev) does not satisfy that requirement.
- doctrine/doctrine-migrations-bundle[v2.0.0, ..., 2.2.1] require php ^7.1 -> your php version (8.3.0-dev) does not satisfy that requirement.
- laminas/laminas-code[4.0.0, ..., 4.4.3] require php ^7.4 || ~8.0.0 -> your php version (8.3.0-dev) does not satisfy that requirement.
- laminas/laminas-code[4.5.0, ..., 4.7.1] require php >=7.4, <8.2 -> your php version (8.3.0-dev) does not satisfy that requirement.
- laminas/laminas-code 4.8.0 requires php ~8.1.0 || ~8.2.0 -> your php version (8.3.0-dev) does not satisfy that requirement.
- friendsofphp/proxy-manager-lts[v1.0.0, ..., v1.0.3] require symfony/filesystem ^4.4.17|^5.0 -> found symfony/filesystem[v4.4.17, ..., v4.4.42, v5.0.0, ..., v5.4.13] but the package is fixed to v6.2.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- doctrine/migrations 3.2.0 requires psr/log ^1.1.3 -> found psr/log[1.1.3, 1.1.4] but the package is fixed to 3.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- doctrine/migrations[3.2.1, ..., 3.3.0] require symfony/console ^3.4 || ^4.4.16 || ^5.0 -> found symfony/console[v3.4.0, ..., v3.4.47, v4.4.16, ..., v4.4.49, v5.0.0, ..., v5.4.17] but it conflicts with your root composer.json require (6.2.).
- doctrine/doctrine-migrations-bundle 1.0.0 requires symfony/framework-bundle ~2.1 -> found symfony/framework-bundle[v2.1.0, ..., v2.8.52] but it conflicts with your root composer.json require (6.2.).
- doctrine/doctrine-migrations-bundle[1.0.1, ..., v1.2.1] require symfony/framework-bundle ~2.3|~3.0 -> found symfony/framework-bundle[v2.3.0, ..., v2.8.52, v3.0.0, ..., v3.4.47] but it conflicts with your root composer.json require (6.2.).
- doctrine/doctrine-migrations-bundle[v1.3.0, ..., v1.3.2] require symfony/framework-bundle ~2.7|~3.3|~4.0 -> found symfony/framework-bundle[v2.7.0, ..., v2.8.52, v3.3.0, ..., v3.4.47, v4.0.0, ..., v4.4.49] but it conflicts with your root composer.json require (6.2.).
- doctrine/doctrine-migrations-bundle[2.2.2, ..., 2.2.3, 3.0.2, ..., 3.2.0] require symfony/framework-bundle ~3.4|~4.0|~5.0 -> found symfony/framework-bundle[v3.4.0, ..., v3.4.47, v4.0.0, ..., v4.4.49, v5.0.0, ..., v5.4.17] but it conflicts with your root composer.json require (6.2.*).
- doctrine/doctrine-migrations-bundle[3.0.0, ..., 3.0.1] require php ^7.2 -> your php version (8.3.0-dev) does not satisfy that requirement.
- symfony/orm-pack[v1.0.0, ..., v1.0.7] require php ^7.0 -> your php version (8.3.0-dev) does not satisfy that requirement.
- Root composer.json requires symfony/webapp-pack * -> satisfiable by symfony/webapp-pack[v1.0.0, ..., v1.1.1].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require symfony/webapp-pack:*" to figure out if any version is installable, or "composer require symfony/webapp-pack:^2.1" if you know which you need.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
unable to run /Users/lesage/Documents/ludovic/programmation/composer.phar require webapp --no-interaction
My composer.json
{
"type": "project",
"license": "proprietary",
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=8.1",
"ext-ctype": "",
"ext-iconv": "",
"symfony/console": "6.2.",
"symfony/dotenv": "6.2.",
"symfony/flex": "^2",
"symfony/framework-bundle": "6.2.",
"symfony/runtime": "6.2.",
"symfony/yaml": "6.2."
},
"require-dev": {
},
"config": {
"allow-plugins": {
"symfony/flex": true,
"symfony/runtime": true
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\Tests\": "tests/"
}
},
"replace": {
"symfony/polyfill-ctype": "",
"symfony/polyfill-iconv": "",
"symfony/polyfill-php72": "",
"symfony/polyfill-php73": "",
"symfony/polyfill-php74": "",
"symfony/polyfill-php80": "",
"symfony/polyfill-php81": ""
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"#auto-scripts"
],
"post-update-cmd": [
"#auto-scripts"
]
},
"conflict": {
"symfony/symfony": ""
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "6.2."
}
}
}
Finally, I resolved the problem. I had a conflict with an old version of php. So, I uninstall et reinstall PHP and it works fine.

How do I update Drupal 9 from ssh command line on OVH server?

I installed Drupal in one click on a OVH server. First bad surprise: I discovered that the installed version 9.1.9 needs a security update to 9.2.9.
Second bad surprise: drush was not installed by default. So I had to install first composer in order to install drush with the command:
curl -sS https://getcomposer.org/installer | php
After some battles, composer was working. I installed drush issuing command:
composer require --dev drush/drush
Probably, the --dev flag was not necessary.
I see that composer is able to list the available updates of drupal by running:
composer show drupal/recommended-project --all
name : drupal/recommended-project
descrip. : Project template for Drupal 9 projects with a relocated document root
keywords :
versions : 9.4.x-dev, 9.3.x-dev, 9.3.0-beta2, 9.3.0-beta1, 9.3.0-alpha1, 9.2.x-dev, 9.2.9, 9.2.8, 9.2.7, 9.2.6, 9.2.5, 9.2.4, 9.2.3, 9.2.2, 9.2.1, 9.2.0, 9.2.0-rc1, 9.2.0-beta3, 9.2.0-beta2, 9.2.0-beta1, 9.2.0-alpha1, 9.1.x-dev, 9.1.14, 9.1.13, 9.1.12, 9.1.11, 9.1.10, 9.1.9, 9.1.8, 9.1.7, 9.1.6, 9.1.5, 9.1.4, 9.1.3, 9.1.2, 9.1.1, 9.1.0, 9.1.0-rc3, 9.1.0-rc2, 9.1.0-rc1, 9.1.0-beta1, 9.1.0-alpha1, 9.0.x-dev, 9.0.14, 9.0.13, 9.0.12, 9.0.11, 9.0.10, 9.0.9, 9.0.8, 9.0.7, 9.0.6, 9.0.5, 9.0.4, 9.0.3, 9.0.2, 9.0.1, 9.0.0, 9.0.0-rc1, 9.0.0-beta3, 9.0.0-beta2, 9.0.0-beta1, 9.0.0-alpha2, 9.0.0-alpha1, 8.9.x-dev, 8.9.20, 8.9.19, 8.9.18, 8.9.17, 8.9.16, 8.9.15, 8.9.14, 8.9.13, 8.9.12, 8.9.11, 8.9.10, 8.9.9, 8.9.8, 8.9.7, 8.9.6, 8.9.5, 8.9.4, 8.9.3, 8.9.2, 8.9.1, 8.9.0, 8.9.0-rc1, 8.9.0-beta3, 8.9.0-beta2, 8.9.0-beta1, 8.8.x-dev, 8.8.12, 8.8.11, 8.8.10, 8.8.9, 8.8.8, 8.8.7, 8.8.6, 8.8.5, 8.8.4, 8.8.3, 8.8.2, 8.8.1, 8.8.0, 8.8.0-rc1, 8.8.0-beta1, 8.8.0-alpha1
type : project
license : GNU General Public License v2.0 or later (GPL-2.0-or-later) (OSI approved) https://spdx.org/licenses/GPL-2.0-or-later.html#licenseText
homepage : https://www.drupal.org/project/drupal
source : [git] https://github.com/drupal/recommended-project.git 7f83a471aca47ffaa981bc8cb8a0cf615163ae5b
dist : [zip] https://api.github.com/repos/drupal/recommended-project/zipball/7f83a471aca47ffaa981bc8cb8a0cf615163ae5b 7f83a471aca47ffaa981bc8cb8a0cf615163ae5b
names : drupal/recommended-project
support
chat : https://www.drupal.org/node/314178
docs : https://www.drupal.org/docs/user_guide/en/index.html
source : https://github.com/drupal/recommended-project/tree/9.4.x
requires
composer/installers ^1.9
drupal/core-composer-scaffold ^9.4
drupal/core-project-message ^9.4
drupal/core-recommended ^9.4
requires (dev)
drupal/core-dev ^9.4
conflicts
drupal/drupal *
My problem is that I installed drupal/drupal that is apparently conflicting with drupal/recommended-project where I see the upgrade of drupal I need.
What should be the next step to upgrade from Drupal 9.1.9 to Drupal 9.2.9? Sorry if this question is trivial, but I am overwhelmed with a huge documentation where I get lost.
UPDATE: this is the composer.json file I found in my home directory:
{
"require-dev": {
"drush/drush": "^10.6"
}
}
And UPDATE2: this is the composer.json file I found in the Drupal root directory:
{
"name": "drupal/legacy-project",
"description": "Project template for Drupal 9 projects with composer following drupal/drupal layout",
"type": "project",
"license": "GPL-2.0-or-later",
"homepage": "https://www.drupal.org/project/drupal",
"support": {
"docs": "https://www.drupal.org/docs/user_guide/en/index.html",
"chat": "https://www.drupal.org/node/314178"
},
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"require": {
"composer/installers": "^1.9",
"drupal/core-composer-scaffold": "^9.1",
"drupal/core-project-message": "^9.1",
"drupal/core-recommended": "^9.1",
"drupal/core-vendor-hardening": "^9.1"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "stable",
"prefer-stable": true,
"config": {
"sort-packages": true
},
"extra": {
"drupal-scaffold": {
"locations": {
"web-root": "./"
}
},
"installer-paths": {
"core": [
"type:drupal-core"
],
"libraries/{$name}": [
"type:drupal-library"
],
"modules/contrib/{$name}": [
"type:drupal-module"
],
"profiles/contrib/{$name}": [
"type:drupal-profile"
],
"themes/contrib/{$name}": [
"type:drupal-theme"
],
"drush/Commands/contrib/{$name}": [
"type:drupal-drush"
],
"modules/custom/{$name}": [
"type:drupal-custom-module"
],
"profiles/custom/{$name}": [
"type:drupal-custom-profile"
],
"themes/custom/{$name}": [
"type:drupal-custom-theme"
]
},
"drupal-core-project-message": {
"include-keys": [
"homepage",
"support"
],
"post-create-project-cmd-message": [
"<bg=blue;fg=white> </>",
"<bg=blue;fg=white> Congratulations, you’ve installed the Drupal codebase </>",
"<bg=blue;fg=white> from the drupal/legacy-project template! </>",
"<bg=blue;fg=white> </>",
"",
"<bg=yellow;fg=black>Next steps</>:",
" * Install the site: https://www.drupal.org/docs/8/install",
" * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
" * Get support: https://www.drupal.org/support",
" * Get involved with the Drupal community:",
" https://www.drupal.org/getting-involved",
" * Remove the plugin that prints this message:",
" composer remove drupal/core-project-message"
]
}
}
}
If your project is new you can do some actions to be on the last version of drupal.
To avoid any conflicts you have to :
rm -rf /vendor
rm composer.lock (this file fix the versions of your dependencies)
then
composer update
It will install last version of every dependencies.
In case if you just want to update drupal dependencies do (without delete composer.lock and /vendor) :
composer update drupal/core-recommended --with-dependencies
I use the inital installation of composer/drush/drupal like this.
The drush part is the important.
composer
PATH=/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php7.4.2/bin:$PATH
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
PATH="$(composer config -g home)/vendor/bin:$PATH"
drush
cd /drushproject/web/
composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader
composer global require consolidation/cgr
cgr drush/drush
# correct DrushLog problems (alternatively run once: drush cr)
composer require drush/drush
drupal
drupal --root=/drushproject/web/

Composer says package of lower version is required in certain contexts. (Drupal)

I have a drupal profile called "orange_profile". It requires a bunch of common modules and requires drupal 9. If I go into the profile and run composer update it installs all the modules and core with proper versions (all beta or stable). Running composer depends drupal/core I can see that nothing is stuck below drupal 9.
But when I go to an actual site and try to install the profile it errors stating that the profile requires drupal ~8.0. I cannot get this to change.
Here is the error output:
composer require drupal/orange_profile:dev-2.0.x
./composer.json has been updated
Running composer update drupal/orange_profile
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires drupal/orange_profile dev-2.0.x -> satisfiable by drupal/orange_profile[dev-2.0.x].
- drupal/orange_profile dev-2.0.x requires drupal/core ~8.0 -> found drupal/core[8.0.0-beta6, ..., 8.9.x-dev] but it conflicts with your root composer.json require (^9.1).
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
Using -W does not help. In fact it sometimes still suggests that I use -W when I am using it.
Here are the composer.jsons:
Orange Profile
{
"name": "drupal/orange_profile",
"type": "drupal-profile",
"description": "Drupal Orange install profile with common modules.",
"homepage": "https://www.drupal.org/project/orange_profile",
"license": "GPL-2.0-or-later",
"require": {
"composer/installers": "^1.9",
"drupal/admin_toolbar": "^2.0",
"drupal/advagg": "^4.0",
"drupal/better_exposed_filters": "^5.0",
"drupal/ckeditor_font": "^1.0",
"drupal/ckeditor_media_embed": "^1.6",
"drupal/coffee": "^1.0",
"drupal/color_field": "^2.0",
"drupal/colorbutton": "^1.1",
"drupal/comments_order": "^1.1",
"drupal/config_inspector": "^1.0",
"drupal/core": "^9.1",
"drupal/ctools": "^3.0",
"drupal/easy_breadcrumb": "^1.12",
"drupal/editor_advanced_link": "^1.4",
"drupal/entity": "^1.2",
"drupal/entity_embed": "^1.0",
"drupal/entity_reference_revisions": "^1.5",
"drupal/field_group": "^3.0",
"drupal/google_analytics": "^3.1",
"drupal/google_tag": "^1.2",
"drupal/honeypot": "^2.0",
"drupal/hotjar": "^2.0",
"drupal/image_effects": "^3.0",
"drupal/imce": "^2.3",
"drupal/linkit": "^6.0",
"drupal/magnific_popup": "^1.4",
"drupal/mailsystem": "^4.1",
"drupal/menu_block": "^1.5",
"drupal/menu_trail_by_path": "^1.1",
"drupal/metatag": "^1.5",
"drupal/orange_starter": "2.0.x-dev",
"drupal/panelbutton": "^1.1",
"drupal/paragraphs": "^1.3",
"drupal/pathauto": "^1.2",
"drupal/schema_metatag": "^1.4",
"drupal/search_api": "^1.8",
"drupal/search_api_solr": "^4.1",
"drupal/simple_sitemap": "^3.8",
"drupal/swiftmailer": "^2.0",
"drupal/token": "^1.3",
"drupal/twig_tweak": "^2.0",
"drupal/userprotect": "^1.0",
"drupal/views_infinite_scroll": "^1.5",
"drupal/webform": "^6.0"
}
}
The site
{
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
},
{
"type": "path",
"url": "../orange_profile",
"options": {
"symlink": false
}
}
],
"require": {
"drupal/core": "^9.1"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true
},
"extra": {
"drupal-scaffold": {
"locations": {
"web-root": "web/"
}
},
"installer-paths": {
"web/core": ["type:drupal-core"],
"web/libraries/{$name}": ["type:drupal-library"],
"web/modules/contrib/{$name}": ["type:drupal-module"],
"web/profiles/contrib/{$name}": ["type:drupal-profile"],
"web/themes/contrib/{$name}": ["type:drupal-theme"],
"drush/Commands/contrib/{$name}": ["type:drupal-drush"],
"web/modules/custom/{$name}": ["type:drupal-custom-module"],
"web/themes/custom/{$name}": ["type:drupal-custom-theme"]
}
}
}
This shows me trying to install just the core package and using a local version of the orange profile but the same happens when I am using the one from the remote repo and core-recommended.
My only hunch is that there is some dependencie down the way which has an odd requirement for something like doctrine as I have seen composer telling me that it's because the core 8.0.0-beta6 requires a specific commit of doctrine. This error appeared a couple times.
Anyone seen similar? I noticed while googling that others got the same or similar errors when trying to install certain modules like drupal/entity.
And one more side note, why can I only see what a package requires when it is installed? It would be more convenient for something like this to see the specific requirements of the profile that are asking for a lower core version.

Can't install laravel packages, symfony/process has wrong version

I tried to install some packages that need a 2.* version but the new laravel version uses 3.*
Is there any way to "downgrade" the package or do I have to wait until the packages are updated to the latest version?
I had the same issue, when I wanted to install sclable/php-latex. It needed symfony process higher than 2.7. Installed was version 3.x.
I thought, everything should be fine, but it did not work.
You just have to modify your composer.json file and set the version higher than 2.
"symfony/process": "^2.7"
as here my composer.json file
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": [ "framework", "laravel" ],
"license": "MIT",
"type": "project",
"minimum-stability": "beta",
"prefer-stable": true,
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"barryvdh/laravel-debugbar": "^2.2",
"symfony/process": "^2.7",
"sclable/php-latex": "0.*",
"anahkiasen/former": "^4.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
Then make an composer update:
composer update -verbose

npm install not installing any packages

Im trying to test an old project, and when i run npm install, all i get is:
npm WARN package.json xx# No repository field.
npm WARN package.json xx# No license field.
My package.json file looks like this:
{
"name": "xx",
"version": "",
"dependencies": {},
"devDependencies": {
"connect-livereload": "~0.3.2",
"grunt": "~0.4.1",
"grunt-bg-shell": "~2.3.1",
"grunt-contrib-csslint": "^0.2.0",
"grunt-contrib-sass": "^0.8.1",
"grunt-contrib-uglify": "^0.6.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-newer": "^0.8.0",
"grunt-ngrok": "^0.2.2",
"load-grunt-tasks": "~0.2.1",
"time-grunt": "~0.2.7"
},
"engines": {
"node": ">=0.8.0"
}
}
I havent run this kind of install in a while and im afraid im forgetting something, any ideas as to what ?
EDIT: it turns out the folder copy i had of the project had already a node_modules folder with everything installed, reason why running npm install wasnt doing anything. Although i thought there would be some kind of warning or message saying all modules are installed already.
Getting the warning is not a concern. If you can see a structure of npm packages being installed after the warning, then it works fine. In case you want to avoid these warning, you can add respository and license fields to your package.json.
"repository": {
"type": "git",
"url": "git://github.com/user/repo.git"
},
"license": "ISC"
You are missing a bracket from the end
{
"name": "xx",
"version": "",
"dependencies": {},
"devDependencies": {
"connect-livereload": "~0.3.2",
"grunt": "~0.4.1",
"grunt-bg-shell": "~2.3.1",
"grunt-contrib-csslint": "^0.2.0",
"grunt-contrib-sass": "^0.8.1",
"grunt-contrib-uglify": "^0.6.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-newer": "^0.8.0",
"grunt-ngrok": "^0.2.2",
"load-grunt-tasks": "~0.2.1",
"time-grunt": "~0.2.7"
},
"engines": {
"node": ">=0.8.0"
}
}
I sugges you to use npm init then install the packages by the cli-tool
for eg:
save to devDepencies
npm install connect-livereload grunt grunt-bg-shell ... --save-dev
save to depencies
npm install express ... --save
read more at: https://docs.npmjs.com/cli/install
It turns out the folder copy i had of the project had already a node_modules folder with everything installed, reason why running npm install wasnt doing anything. Although i thought there would be some kind of warning or message saying all modules are installed already.

Resources