"Your requirements could not be resolved to an installable set of packages." when creating a Magento 2 project - composer-php

I am following along with this tutorial for installing Magento 2.3 on Ubuntu. I am able to get up to the point where I'm supposed to use composer to create a Magento 2 project using this command:
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.3.0 .
After inputting this command, I get the following output:
Creating a "magento/project-community-edition=2.3.0" project at "./"
Installing magento/project-community-edition (2.3.0)
- Installing magento/project-community-edition (2.3.0): Extracting archive
Created project in /var/www/html/.
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 magento/product-community-edition 2.3.0 -> satisfiable by magento/product-community-edition[2.3.0].
- magento/product-community-edition 2.3.0 requires magento/composer ~1.4.0 -> satisfiable by magento/composer[1.4.0] from composer repo (https://repo.packagist.org) but magento/composer[1.0.2, ..., 1.6.0] from composer repo (https://repo.magento.com) has higher repository priority. The packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.
I have been following the tutorial exactly, however there error does not appear in the tutorial. Does anyone know how to fix this error?

You may find in m2 docs that 2.3.0 doesn't support composer 2
https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements.html
So use
composer self-update --1

I faced with the same issue.
After changing version of the composer:
composer self-update 1.4.0
the problem was solved.

Related

Issue when installing composer on Ubuntu server

I Want to install laravel app and I user composer like this to install packages
composer install
And I get this error
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for doctrine/dbal 3.3.5 -> satisfiable by doctrine/dbal[3.3.5].
- doctrine/dbal 3.3.5 requires composer-runtime-api ^2 -> no matching package found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
- It's a private package and you forgot to add a custom repository to find it
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
I search any solution on the web without succes.
I'm on ubuntu server 20.04
Thank you
you have to upgrade the composer to version ^2.
run this command before "composer install"
=> composer self-update --2

Your requirements could not be resolved to an installable set of packages - laravel / valet

I am running this command on the terminal:
composer global require laravel/valet
but I got this error message:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- friendsofphp/php-cs-fixer is locked to version v2.16.4 and an update of this package was not requested.
- friendsofphp/php-cs-fixer v2.16.4 requires php ^5.6 || ^7.0 -> your php version (8.1.5) does not satisfy that requirement.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require laravel/valet:*" to figure out if any version is installable, or "composer require laravel/valet:^2.1" if you know which you need.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
I search on google but couldn't find any solution.
PHP version I am running is 8.08 on MAMP
How can I solve it?
Run composer global require laravel/valet:*.
This will check any installable version is available for your dev environment and install the package.

What is the error I am making when I'm installing the passport dependencies?

Using version ^10.1 for laravel/passport
./composer.json has been updated
Running composer update laravel/passport
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/passport[v10.1.0, ..., 10.x-dev] require illuminate/auth ^8.2 -> found illuminate/auth[v8.2.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.
- Root composer.json requires laravel/passport ^10.1 -> satisfiable by laravel/passport[v10.1.0, v10.1.1, v10.1.2, 10.x-dev].
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
you must check your project dependencies and laravel dependencies , you can test this remove composer.lock file and run this composer install
You need to upgrade your Laravel or install an older version of Laravel Passport
composer require laravel/passport:X.x.x

Composer 2, which some of your plugins seem to be incompatible with

I tried to install extension from the magento market place but I got incompatibility error..
Problem 1
magento/composer-root-update-plugin is locked to version 1.0.0 and an update of this package was not requested.
magento/composer-root-update-plugin 1.0.0 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
Problem 2
dealerdirect/phpcodesniffer-composer-installer is locked to version v0.5.0 and an update of this package was not requested.
dealerdirect/phpcodesniffer-composer-installer v0.5.0 requires composer-plugin-api ^1.0 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
Problem 3
laminas/laminas-dependency-plugin 1.0.4 requires composer-plugin-api ^1.1 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
magento/product-community-edition 2.4.1 requires laminas/laminas-dependency-plugin ^1.0 -> satisfiable by laminas/laminas-dependency-plugin[1.0.4].
magento/product-community-edition is locked to version 2.4.1 and an update of this package was not requested.
You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.
how do I resolve this?
You can downgrade your Composer to version 1.x
composer self-update --1
And if you need to switch back to Composer version 2.x, you can just type
composer self-update --2
Magento 2.x is not yet compatible with composer 2.x
You can either:
downgrade your system version of Composer to 1.x
download composer 1.x phar file and run local version (preferable)
https://getcomposer.org/download/
Current version is 1.10.19
then run the command using the local composer version:
php ./composer.phar install
Magento does not support Composer 2.x. please ref the link:https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements.html may help you

Composer Google API Download Failed

I tried to download google api using composer to a legacy code but, the following error appeared:
composer require google/apiclient:^2.0
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for google/apiclient 2.0 -> satisfiable by google/apiclient[v2.0.0].
- google/apiclient v2.0.0 requires google/auth 0.8 -> satisfiable by google/auth[v0.8].
- Conclusion: don't install guzzlehttp/psr7 1.4.2
- google/auth v0.8 requires guzzlehttp/psr7 1.2.* -> satisfiable by guzzlehttp/psr7[1.2.0, 1.2.1, 1.2.2, 1.2.3].
- Can only install one of: guzzlehttp/psr7[1.2.0, 1.4.2].
- Can only install one of: guzzlehttp/psr7[1.2.1, 1.4.2].
- Can only install one of: guzzlehttp/psr7[1.2.2, 1.4.2].
- Can only install one of: guzzlehttp/psr7[1.2.3, 1.4.2].
- Installation request for guzzlehttp/psr7 (locked at 1.4.2) -> satisfiable by guzzlehttp/psr7[1.4.2].
Installation failed, reverting ./composer.json to its original content.
What should I do?
Try removing vendor/google and then run composer install again, this worked for me.
Can only install one of: guzzlehttp/psr7[1.2.3, 1.4.2].
Your dependencies led to confusion of two different major versions of the package, but only one can be installed.
The locked at 1.4.2 message means this package has been already installed as per your composer.lock file, and you're trying to install different version not compatible with your existing criteria.
$ composer show -a google/auth | grep psr7
guzzlehttp/psr7 ~1.2
You can check which existing package depends on the locked version by checking the dependency tree:
composer show -t
In some cases, removing composer.lock may help.
Otherwise, to see why (from where) the package is referenced, run:
composer why guzzlehttp/psr7 -t
See also: How to resolve a "Can only install one of:" conflict?
I finally found a solution for me, it works just removing composer.lock!!

Resources