How can I resolve "Your requirements could not be resolved to an installable set of packages" error? - laravel

When I run composer update I receive some wired output.
Here is my composer.json look like.
{
"name": "laravel/laravel",
"description": "The Laravel Framework.", "keywords": ["framework", "laravel"],
"license": "MIT",
"repositories": [{
"type": "vcs",
"url": "https://github.com/Zizaco/ardent.git"
}],
"require-dev": {
"phpunit/phpunit": "4.3.*"
},
"require": {
"laravel/framework": "4.2.*",
"laravelbook/ardent": "dev-master as 2.4.0",
"zizaco/entrust": "dev-master",
"sebklaus/profiler": "dev-master",
"doctrine/dbal": "dev-master"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations", "app/database/seeds", "app/tests",
"app/libraries"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "stable"
}
How do I fix that ?

Run this command:
composer install --ignore-platform-reqs
or
composer update --ignore-platform-reqs
Composer ignore-platform-reqs flag explanation

Your software dependencies have an incompatible version conflict.
At the same time you want to install any Laravel 4.2.x version, and "zizaco/entrust" from its master branch. And that master branch requires at least Laravel 5.0 (roughly speaking).
The problem comes from the dependency on branches. It's likely that the package zizaco/entrust once was using Laravel 4.2 in its master branch, and that you were able to install your dependencies at that day. But the very moment this branch gets updated with an incompatible version requirement, you will never ever be able to run composer update and get updated dependencies.
Always use tagged versions! Ideally you use a relaxed version requirement that allows for compatible updates. This should be expressed as a tilde-two-number version requirement: ~1.2 would install a version 1.2.0 and up (like 1.2.99 or 1.2.100), and also 1.3 and up. If you need a certain patch release: Caret-three-number version ^1.2.10 will install 1.2.10 or up, also 1.3 and up.
Using this version requirement instead of dev-master will allow you to use released versions instead of the unstable state in the master branch, and allows you to address the most recent version that still works with Laravel 4.2. I guess that would be zizaco/entrust version 1.3.0, but version 1.2 would also qualify. Go with "zizaco/entrust": "~1.2".

I am facing the same issue. I am using 'Lumen' microservice framework.
I recently resolved the same issue by installing two packages:-
sudo apt-get install php7.0-mbstring,
sudo apt-get install php7.0-xml or sudo apt-get install php-xml
After installing this, you need to execute this command:-
composer update
Hope, it will resolve the issue. I work on my system.

The simplest solution is adding --ignore-platform-reqs flag.
If you are running composer install or composer update use it with --ignore-platform-reqs flag
Example
composer install --ignore-platform-reqs
Or
composer update --ignore-platform-reqs
And this should do the trick!

I use Windows 10 machine working with PHP 8 and Lavarel 8 and I got the same error, I used the following command :-
composer update --ignore-platform-reqs
to update all the packages regardless of the version conflicts.

Were those dev-masters added automatically? Avoid them as unnecessary version constraints, for 'any suitable version' use "*", or "#dev" if you don't mind dev packages. My guess is that Entrust is the potential troublemaker.
Also, "minimum-stability": "stable" imposes additional constraints, and
"minimum-stability": "dev",
"prefer-stable": true
is more conflict-free, consider it a rule of thumb.

I solved the same issue setting 'laravel/framework' dependency version from "^8.0" to "^7.0".
After that running composer update --ignore-platform-reqs simply worked
composer.json

I am facing the same issue in Laravel v8.49.0 (PHP v8.0.6). Using Composer through install packages
I recently resolved the same issue by installing two packages:-
composer create-project laravel/laravel myapp
Composer Update
composer update --ignore-platform-reqs
OR
composer install --ignore-platform-reqs
Check Start Server
php artisan serve

You must be in the correct directory so cd into it, then:
composer update --ignore-platform-reqs if you have previous installed composer as Vivek M suggests. My problem was wrong directory.
cd into: xampp/htdocs/laravelProjects/laravelP1

Add "barryvdh/laravel-cors": "^0.7.3" at the end of require array inside composer.json
Save composer.json and run composer update
You are done !

I solved the same error, by adding "zizaco/entrust": "*" instead of the "zizaco/entrust": "~1.2".

Install the following according to the PHP version installed on your system:
sudo apt-get install php8.0-curl php8.0-gd php8.0-xsl php8.0-dom
Finally try again to create the laravel project with composer
composer create-project laravel/laravel myProject

I encountered this problem in Laravel 5.8, what I did was to do composer require for each library and all where installed correctly.
Like so:
instead of adding it to the composer.json file or specifying a version:
composer require msurguy/honeypot: dev-master
I instead did without specifying any version:
composer require msurguy/honeypot
I hope it helps, thanks

"config": {
"platform": {
"ext-pcntl": "7.2",
"ext-posix": "7.2"
}
}

If you are using php ^8.0
open list of available php versions
sudo update-alternatives --config php
switch to on of the older versions above PHP 7.2, select one of them
then update composer
composer update

CAUSE:
The error is happening because your project folder is owned by the root user.
SOLUTION
Change ownership to the currently signed in user and not the root user. If you only have root as the sole user, create another user with root privileges.
$ sudo chown -R current_user /my/project/directory/
then
$ composer install

Just activate the curl in the php.ini file
;extension=php_curl.dll
to
extension=php_curl.dll
and then composer install

Related

I got de error when I tried install composer league/flysystem-aws-s3-v3

I got de error when I tried install composer league/flysystem-aws-s3-v3
My line: composer require league/flysystem-aws-s3-v3
I using Laravel 8 and php 7.3
I also tested removing composer.lock
Someone already fixed it?
Your requirements could not be resolved to an installable set of packages.
Problem 1
- league/flysystem-aws-s3-v3[2.0.0, ..., 2.x-dev] require league/flysystem ^2.0.0 -> found league/flysystem[2.0.0-alpha.1, ..., 2.x-dev] but the package is fixed to 1.1.3 (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.
- league/flysystem-aws-s3-v3[2.0.0-alpha.1, ..., 2.0.0-alpha.2] require league/flysystem 2.0.0-alpha.1 -> found league/flysystem[2.0.0-alpha.1] but the package is fixed to 1.1.3 (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.
- league/flysystem-aws-s3-v3[2.0.0-alpha.4, ..., 2.0.0-beta.1] require league/flysystem 2.0.0-alpha.3 -> found league/flysystem[2.0.0-alpha.3] but the package is fixed to 1.1.3 (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.
- league/flysystem-aws-s3-v3[2.0.0-beta.2, ..., 2.0.0-beta.3] require league/flysystem ^2.0.0-beta.1 -> found league/flysystem[2.0.0-beta.1, ..., 2.x-dev] but the package is fixed to 1.1.3 (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.
- league/flysystem-aws-s3-v3 2.0.0-RC1 requires league/flysystem ^2.0.0-RC1 -> found league/flysystem[2.0.0-RC1, 2.0.0, 2.x-dev] but the package is fixed to 1.1.3 (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.
- Root composer.json requires league/flysystem-aws-s3-v3 ^2.0 -> satisfiable by league/flysystem-aws-s3-v3[2.0.0-alpha.1, ..., 2.x-dev].
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.
My composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.3",
"aws/aws-sdk-php": "^3.166",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.17",
"laravel/tinker": "^2.0",
"tymon/jwt-auth": "^1.0"
},
...
I have faced the same problem. I tried this and it's helpful
composer require league/flysystem-aws-s3-v3 ~1.0
You could try
composer require league/flysystem-aws-s3-v3 ^1.0
I search a solution, put this line in my composer.json using tilde before 1.0
"league/flysystem-aws-s3-v3": "~1.0",
It working!!
The laravel documentation suggests this command for Laravel 8
composer require --with-all-dependencies league/flysystem-aws-s3-v3 "^1.0"
and it worked for me. Earlier, I was trying to install using the command from an older version of laravel docs.
My PHP version is 7.4
Ref: https://laravel.com/docs/8.x/filesystem#composer-packages
There are 2 ways with php 7.x and laravel 8 :
In mac :
composer require league/flysystem-aws-s3-v3 ~1.0
In windows :
composer require league/flysystem-aws-s3-v3 ~1.0 --ignore-platform-reqs
EDIT: when we use ~1.0, it means that we need this approximate version. And in windows, using the --ignore-platform-reqs skip the problems if you don't have all requirements, plugins etc, it's not the most efficient way but it can help temporary until production deployment. If you don't use --ignore-platform-reqs in windows, maybe it can works, depending your environment.
According to this post:
using ~version: "Approximately equivalent to version", will update you to all future patch versions, without incrementing the minor version. ~1.2.3 will use releases from 1.2.3 to <1.3.0.
using ^version: "Compatible with version", will update you to all future minor/patch versions, without incrementing the major version. ^2.3.4 will use releases from 2.3.4 to <3.0.0.
Follow these steps and you will be able to install both packages
uninstall the current guzzle version
composer remove guzzlehttp/guzzle
install the flysystem ver. - 1.0.0
composer require league/flysystem-aws-s3-v3:^1.0
Good luck :-)
in this order it seems that laravel 8 is able to download and install both s

Can I solve "Your requirements could not be resolved to an installable set of packages." in laravel composer

when I want to install laravel/ui the composer show this:
and my composer.json :
my laravel version is 6.13 and I went to laravel.com and I click the Authentication for laravel 6X and says for laravel 6 you have to install this package and the package is composer require laravel/ui "^1.0" --dev and composer show me that problem again what can I do?
Add this in composer.json and then use command composer update
"laravel/ui": "^1.2",
Sometimes the library which you're installing is not satisfied PHP version not only laravel version.

Composer Magento 2 - can't install dev-master

I want to run composer install and use modules with stability flag dev-master.
But composer won't install them.
What can I do to install these modules?
I use this command:
composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader
The result is that only modules with a version will be installed like:
"require": {
"magento/product-community-edition": "2.1.7",
"composer/composer": "#alpha",
"company/magento2-mymodule-name": "dev-master",
"company/magento2-mytheme-name": "dev-master",
Do you have already file composer.lock created? If so, try running composer update.

Install specific version using laravel installer

As of now, if I use this command
laravel new blog
It will create a laravel project with the latest version like 5.2, but what if I want to install a specific version, ie. version 5.1?
UPDATE:: I am looking for laravel installer command, is there is any option/parameter for specific version installation?
Using composer you can specify the version you want easily by running
composer create-project laravel/laravel="5.1.*" myProject
Using the 5.1.* will ensure that you get all the latest patches in the 5.1 branch.
use
laravel new blog --version
Example laravel new blog --5.1
You can also use the composer method
composer create-project laravel/laravel app "5.1.*"
here, app is the name of your project
please see the documentation for laravel 5.1 here
UPDATE:
The above commands are no longer supports so please use
composer create-project laravel/laravel="5.1.*" appName
You can use composer method
like
composer create-project laravel/laravel blog "5.1"
Or here is the composer file
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
use laravel new blog --5.1
make sure you must have laravel installer 1.3.4 version.
The direct way as mentioned in the documentation:
composer create-project --prefer-dist laravel/laravel blog "6.*"
https://laravel.com/docs/6.x/installation
Via composer installing specific version 8.*
composer create-project laravel/laravel:^8.* project_name
using composer installing specific version 7.*
composer create-project --prefer-dist laravel/laravel:^7.0 project_name
To install specific version 6.* and below use the following command:
composer create-project --prefer-dist laravel/laravel project_name "6.*"
Year 2022
Since Laravel 5.2 (2017) it is not possible to install a specific Laravel Version via Laravel Installer. Use instead composer create-project. For example:
composer create-project --prefer-dist laravel/laravel blog "7.*"
// That will install Version the latest version of Laravel 7.
// would install:
"laravel/framework": "^7.29",
composer create-project --prefer-dist laravel/laravel blog "5.*"
// would install:
"laravel/framework": "5.8.*",
composer create-project --prefer-dist laravel/laravel blog
Would install the latest Laravel version on your local machine.
For newer version of laravel:
composer create-project --prefer-dist laravel/laravel=5.5.* project_name
From Laravel 6, Now It's working with the following command:
composer create-project --prefer-dist laravel/laravel:^7.0 blog
you can find all version install code here by changing the version of laravel doc
composer create-project --prefer-dist laravel/laravel yourProjectName "5.1.*"
above code for creating laravel 5.1 version project.
see more in laravel doc. happy coding!!
you can use this command
composer create-project laravel/laravel:^8.*.* exam-app
composer create-project --prefer-dist laravel/laravel project_name "version_num"
Example ::
suppose, i would like to create a new project called- blog
where i would like to use laravel 6.0 LTS version,,
following that command
composer create-project --prefer-dist laravel/laravel blog "6.*"
Another possibility is to
laravel new my-project --branch 9.x

composer + rocketeer + laravel 5.1 - cannot install rocketeer in laravel 5.1.17

I tried to install rocketeer on laravel 5.1.17 using composer but couldn't succeed.
Is it incompatible with latest version of laravel or what might be the problem?
The latest versions of the illuminate/log are 4.2.x-dev, 5.1.x-dev, and 5.2.x-dev.
This means that you want to add this line to the end of yourcomposer.json file:
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev"

Resources