Composer stating requirements not met - composer-php

I have a simple composer package with the following require:
{
"require": {
"vlucas/phpdotenv": "^5.4",
"wp-cli/wp-cli-bundle": "^2.6"
}
}
When I run the app, I get the following error:
Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.2".
Looking at the composer.json of each package, the current version of PHP I am using (7.4) should be viable. (I have to use 7.4 as one WP plugin breaks with php >8).
Dotenv reports:
"require": {
"php": "^7.1.3 || ^8.0",
...
and wp-cli-bundle reports:
"require": {
"php": ">=5.6",
...
Confused as to why I am getting error issue.

Related

Problem with installing a Laravel package using composer

I want to using a package in my project.
Composer.json:
"require": {
"php": "^7.2.5|^8.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^6.3.1|^7.0.1",
"hekmatinasser/verta": "^1.11",
"laravel/framework": "^7.29",
"laravel/passport": "^9.3",
"laravel/tinker": "^2.5",
"lcobucci/jwt": "3.3.3",
"pishran/zarinpal": "^2.2"
},
My target package to install :
composer require ipecompany/smsirlaravel
Problem : When I try this on composer, I see follwing error
Problem 1
- ipecompany/smsirlaravel[v1.0.0, ..., v1.0.7] require guzzlehttp/guzzle ~6.0 -> found guzzlehttp/guzzle[6.0.0, ..., 6.5.x-dev] but the package is fixed to 7.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.
- Root composer.json requires ipecompany/smsirlaravel ^1.0 -> satisfiable by ipecompany/smsirlaravel[v1.0.0, ..., v1.0.7].
I tried :
composer require ipecompany/smsirlaravel -W
But the main problem is Laravel Passport maybe because of following error :
Problem 1
- laravel/passport is locked to version v9.3.2 and an update of this package was not requested.
- laravel/passport v9.3.2 requires laminas/laminas-diactoros ^2.2 -> found laminas/laminas-diactoros[2.2.0, ..., 2.6.x-dev] but it conflicts with another require.
I tried to install laminas/laminas-diactoros ^2.2 but I got another error
problem 1
- Root composer.json requires laminas/laminas-diactoros 2.2, found laminas/laminas-diactoros[2.2.0] but it conflicts with another require.
Problem 2
- laravel/passport is locked to version v9.3.2 and an update of this package was not requested.
- laravel/passport v9.3.2 requires laminas/laminas-diactoros ^2.2 -> found laminas/laminas-diactoros[2.2.0, ..., 2.6.x-dev] but it conflicts with another require.
Any body can help me to install this package? TNX
As written in the first error message: ipecompany/smsirlaravel requires v6 of Guzzle, but currently v7 is installed. You should use a different version constraint for Guzzle first: change "guzzlehttp/guzzle": "^6.3.1|^7.0.1" to "guzzlehttp/guzzle": "^6.3.1". Afterwards, run composer update guzzlehttp/guzzle such that Guzzle v6 is installed.
Afterwards, running composer require ipecompany/smsirlaravel should work

Error installing package (Installation failed, reverting ./composer.json to its original content.) (Laravel admin package - Voyager) [duplicate]

This question already has answers here:
Composer error: "PHP extension fileinfo is missing from your system"
(12 answers)
How can I resolve "Your requirements could not be resolved to an installable set of packages" error?
(17 answers)
Closed 3 years ago.
i want to install a laravel admin package -voyager version 1.3 ,so when i run this cmd $ composer require tcg/voyager i got this error always , is about the file composer.json
Using version ^1.3 for tcg/voyager
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
- tcg/voyager v1.3.0 requires intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.5.0, 2.5.1].
- tcg/voyager v1.3.1 requires intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.5.0, 2.5.1].
- intervention/image 2.4.3 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
- intervention/image 2.4.2 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
- Installation request for tcg/voyager ^1.3 -> satisfiable by tcg/voyager[v1.3.0, v1.3.1].
To enable extensions, verify that they are enabled in your .ini files:
- C:\AppServ\php7\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.
and this is the file composer.json :
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2",
"fideloper/proxy": "^4.0",
"laravel/framework": "^6.2",
"laravel/tinker": "^2.0"
},
"require-dev": {
"facade/ignition": "^1.4",
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^8.0"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
}, ..
, Do you know how to solve that? my laravel version : 6.12
Try enabling php_fileinfo.dll in you php.ini file. Just remove ; from the below line and restart your server
;extension=php_fileinfo.dll

composer installation fails - jimmyjs/laravel-report-generator

Trying to install jimmyjs/laravel-report-generator
Command:
composer require jimmyjs/laravel-report-generator
Output:
vagrant#homestead:~/code/BEAM$ composer require jimmyjs/laravel-report-generator
Using version ^1.1 for jimmyjs/laravel-report-generator
./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
- Can only install one of: maatwebsite/excel[2.1.x-dev, 3.1.11].
- Can only install one of: maatwebsite/excel[3.1.11, 2.1.x-dev].
- Can only install one of: maatwebsite/excel[2.1.x-dev, 3.1.11].
- jimmyjs/laravel-report-generator 1.1.0 requires maatwebsite/excel ~2.1.0
-> satisfiable by maatwebsite/excel[2.1.x-dev].
- Installation request for jimmyjs/laravel-report-generator ^1.1
-> satisfiable by jimmyjs/laravel-report-generator[1.1.0].
- Installation request for maatwebsite/excel (locked at 3.1.11, required as ^3.1)
-> satisfiable by maatwebsite/excel[3.1.11].
Installation failed, reverting ./composer.json to its original content.
I don't know if I'm misunderstanding the error? Says I can only have one maatwebsite (which is the case)?
composer.json current require which has maatwebsite (only instance) in it:
"require": {
"php": ">=7.1.3",
"barryvdh/laravel-snappy": "^0.4.4",
"fideloper/proxy": "^4.0",
"h4cc/wkhtmltoimage-amd64": "0.12.x",
"h4cc/wkhtmltopdf-amd64": "0.12.x",
"laravel/framework": "5.8.*",
"laravel/tinker": "^1.0",
"laravelcollective/html": "^5.6",
"maatwebsite/excel": "^3.1",
"spatie/laravel-permission": "^2.13"
},
if you need explicitly that version of Maatwebsite ("maatwebsite/excel": "^3.1",), then you cant fix it cause jimmyjs/laravel-report-generator is not up to date with the new version of maatwebsite.
if you dont need the version 3 of Maatwebsite, you can remove the requirement for it and jimmyjs/laravel-report-generator will require the version maatwebsite/excel 2.1.x-dev.
wich might have some issue with your current version of php (7.1).
Better look for another alternative to jimmyjs/laravel-report-generator that uses the V3 of maatwebsite or something else
Or even better, do it yourself instead of using jimmyjs/laravel-report-generator. Maatwebsite v3 is really easy to use
If you have looked it then your version is 3.1 "maatwebsite/excel": "^3.1",
Now check your error
Problem 1
- Can only install one of: maatwebsite/excel[2.1.x-dev, 3.1.11].
it says you need to install in "maatwebsite/excel": "^2.1"
Change and Add in your composer.json file:
"require": {
"jimmyjs/laravel-report-generator": "^1.1",
"maatwebsite/excel": "^2.1"
},
after, run this command in your command prompt composer update

Your requirements could not be resolved: failed to open stream: Permission denied

I Need to install DomPDf in my Project. So, i add "barryvdh/laravel-dompdf": "v0.7.0", to composer require block. when i update composer display following Errors. Whats my Mistakes.... Please Specify to me..
Terminal Errors
Your requirements could not be resolved to an installable set of packages.
Problem 1
- dompdf/dompdf v0.7.0-beta3 requires phenx/php-font-lib 0.4.* -> no matching package found.
- dompdf/dompdf v0.7.0-beta2 requires phenx/php-font-lib 0.4.* -> no matching package found.
- dompdf/dompdf v0.7.0-beta requires phenx/php-font-lib 0.3.* -> no matching package found.
- dompdf/dompdf v0.7.0 requires phenx/php-font-lib 0.4.* -> no matching package found.
- dompdf/dompdf 0.7.x-dev requires phenx/php-font-lib 0.5.* -> no matching package found.
- barryvdh/laravel-dompdf v0.7.0 requires dompdf/dompdf ^0.7 -> satisfiable by dompdf/dompdf[0.7.x-dev, v0.7.0, v0.7.0-beta, v0.7.0-beta2, v0.7.0-beta3].
- Installation request for barryvdh/laravel-dompdf v0.7.0 -> satisfiable by barryvdh/laravel-dompdf[v0.7.0].
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.
My Composer Code
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"minimum-stability" : "dev",
"prefer-stable": true,
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"barryvdh/laravel-debugbar": "^2.3",
"barryvdh/laravel-dompdf": "v0.7.0",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"uxweb/sweet-alert": "^1.4"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.0"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
}
I've also tried:
composer require barryvdh/laravel-dompdf
but it display following error:
Error : Using version ^0.8.0 for barryvdh/laravel-dompdf ./composer.json has been updated Loading composer repositories with package information
Updating dependencies (including require-dev)
file_put_contents(/home/w3cert/.composer/cache/repo/https---‌​packagist.org/p-prov‌​ider-2017-01.json): failed to open stream: Permission denied
packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
Your requirements could not be resolved to an installable set of packages.
Since you've got the Permission denied error when running composer require barryvdh/laravel-dompdf, this is the command which should fix them:
chown -R $USER ~/.composer
or:
sudo chown -R $USER ~/.composer
Then clear the Composer caches:
composer clear
After than try to avoid running composer command with sudo to not break the file permissions.
If there is still any problem, in order to troubleshoot, run the following shell command:
composer diagnose
Why don't you try to install it from the command line
composer require barryvdh/laravel-dompdf
please delete this line from composer.json before installation.
"barryvdh/laravel-dompdf": "v0.7.0"
Anyway the current version of laravel-dompdf:(v0.8.0)
The installation should work with the current version of dompdf
"barryvdh/laravel-dompdf": "^0.8.0"

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

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

Resources