yii2 composer update error: Invalid version string "2.*" - composer-php

I'm use composer update in a Yii2 project, but it is exiting with an exception.
I have updated composer to the lastest version, c6cc6dd6070871f4b198ed39f76dd8047c116b02, but it still doesn't work:
Importing tag v2.0.2 (2.0.2.0)
Reading bower.json of bower-asset/yii2-pjax (v2.0.1)
Reading /home/xiaoai/.composer/cache/repo/github.com/yiisoft/jquery-pjax/bower-f07ce95f6098c0bd5421789a20789f39a19be73b from cache
Importing tag v2.0.1 (2.0.1.0)
Reading /home/xiaoai/.composer/cache/repo/https---packagist.org/provider-yiisoft$yii2-bootstrap.json from cache
Reading /home/xiaoai/.composer/cache/repo/https---packagist.org/provider-bower-asset$bootstrap.json from cache
Downloading https://bower.herokuapp.com/packages/bootstrap
Writing /home/xiaoai/.composer/cache/repo/https---bower.herokuapp.com-packages/bootstrap-3c71cc99d2fc1c12a3d3e1b27e448ca612a89a1d-package.json into cache
Adding VCS repository bower-asset/bootstrap
Downloading https://api.github.com/repos/twbs/bootstrap
Downloading https://api.github.com/repos/twbs/bootstrap/contents/bower.json?ref=master
Downloading https://api.github.com/repos/twbs/bootstrap/commits/master
Downloading https://api.github.com/repos/twbs/bootstrap/tags?per_page=100
Downloading https://api.github.com/repos/twbs/bootstrap/git/refs/heads?per_page=100
[UnexpectedValueException]
Could not parse version constraint <=2.*: Invalid version string "2.*"
Exception trace:
() at phar:///usr/bin/composer.phar/src/Composer/Package/Version/VersionParser.php:461
Composer\Package\Version\VersionParser->parseConstraint() at phar:///usr/bin/composer.phar/src/Composer/Package/Version/VersionParser.php:257
Composer\Package\Version\VersionParser->parseConstraints() at phar:///usr/bin/composer.phar/src/Composer/Package/Loader/ArrayLoader.php:234
Composer\Package\Loader\ArrayLoader->parseLinks() at phar:///usr/bin/composer.phar/src/Composer/Package/Loader/ArrayLoader.php:123
Composer\Package\Loader\ArrayLoader->load() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/AssetVcsRepository.php:174
Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository->preInitBranchPackage() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/AssetVcsRepository.php:138
Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository->initBranches() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/AssetVcsRepository.php:45
Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository->initialize() at phar:///usr/bin/composer.phar/src/Composer/Repository/ArrayRepository.php:178
Composer\Repository\ArrayRepository->getPackages() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:104
Composer\DependencyResolver\Pool->addRepository() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/Util.php:60
Fxp\Composer\AssetPlugin\Repository\Util::addRepositoryInstance() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/Util.php:39
Fxp\Composer\AssetPlugin\Repository\Util::addRepository() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/AbstractAssetsRepository.php:139
Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRepository->whatProvides() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:199
Composer\DependencyResolver\Pool->computeWhatProvides() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:188
Composer\DependencyResolver\Pool->whatProvides() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:161
Composer\DependencyResolver\RuleSetGenerator->whitelistFromPackage() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:273
Composer\DependencyResolver\RuleSetGenerator->whitelistFromJobs() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:324
Composer\DependencyResolver\RuleSetGenerator->getRulesFor() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/Solver.php:177
Composer\DependencyResolver\Solver->solve() at phar:///usr/bin/composer.phar/src/Composer/Installer.php:505
Composer\Installer->doInstall() at phar:///usr/bin/composer.phar/src/Composer/Installer.php:230
Composer\Installer->run() at phar:///usr/bin/composer.phar/src/Composer/Command/UpdateCommand.php:140
I don't think this is my mistake, but how do I fix the exception?

Michael Nguyen's answer did not work for me, but updating to dev-master did:
php composer.phar global require "fxp/composer-asset-plugin:dev-master"
One may also need to update composer itself:
php composer.phar self-update
Also there was an extensive discussion on this yesterday: link.
UPDATE. It seems to me at this moment "fxp/composer-asset-plugin:1.0.*#dev" is better again.

I have the same issue and discussed on Yii Forum. It seems like this is a bug with "fxp/composer-asset-plugin".
Try
php composer.phar global require "fxp/composer-asset-plugin:1.0.1"
Then do whatever you need with composer
The bug is discussed at https://github.com/francoispluchino/composer-asset-plugin/issues/129

It helped for me
composer self-update
composer global update

Related

First composer package published not found

i know this has already been asked but, i can't see what is going wrong without asking.
I've created a packagist for a custom code hosted on github.
Packagist : https://packagist.org/packages/claims/module-logger
Github : https://github.com/Minirock/claims-module-logger
But when i try to load it using composer, it says it can't find it.
composer require claims/module-logger
Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/
Info from https://repo.packagist.org: #StandWithUkraine
In InitCommand.php line 785:
Could not find a version of package claims/module-logger matching your minimum-stability (dev). Require it with an explicit version constraint allowing its desired stability.
I'm pretty sure this has to do with composer version but, how can i check if my package is available for composer 1 and / or 2. If not available for composer 1 (which is mandatory in my case) how can i make it accessible ?
I also tried specifying the version
composer require claims/module-logger:dev-main
Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/
Info from https://repo.packagist.org: #StandWithUkraine
In InitCommand.php line 792:
Could not find package claims/module-logger.
Did you mean this?
claims/module-logger
I has exactly the same problem.
I updated my composer version (using composer self-update).
I confirm the problem persist.
The github : https://github.com/j-barth/test
The packagist : https://packagist.org/packages/jbarthes/test
Thank you

Upgrading my Laravel Yajra Table

I'm currently in 7.5.0 and I want to upgrade to 8.0.3, I followed the steps in https://yajrabox.com/docs/laravel-datatables/master/upgrade but I encountered this error
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Updating yajra/laravel-datatables-oracle (v7.5.0 => v8.0.3): Downloading (conneDownloading (100%)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Yajra\Datatables\DatatablesServiceProvider' not found
Script php artisan optimize handling the post-update-cmd event returned with error code 1
Installation failed, reverting ./composer.json to its original content.
In the Yajra DataTables V8 the Namespace and Facade was updated.
https://yajrabox.com/docs/laravel-datatables/master/upgrade#namespace
https://yajrabox.com/docs/laravel-datatables/master/upgrade#facade
In folder config/app.php, temporarily comment out
Yajra\Datatables\DatatablesServiceProvider.
Run command composer update.
Uncomment the provider Yajra\Datatables\DatatablesServiceProvider.
Done.
To make sure it works, can run again command composer update.
Reference from: https://yajrabox.com/docs/laravel-datatables/master/upgrade#v5-to-v6

Composer: Your requirements could not be resolved to an installable set of packages

I am trying to install a composer package and I continuously get the following error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package rondobley/extended-respect-validation could not be found in any version, there may be a typo in the package name.
Here is the composer.json
{
"minimum-stability": "dev",
"require": {
"rondobley/extended-respect-validation": "^1.0"
}
}
And the output from composer install -vvv:
vagrant#wheezy:/code/test$ composer install -vvv
Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/code/test): git branch --no-color --no-abbrev -v
Executing command (/code/test): git describe --exact-match --tags
Executing command (/code/test): git log --pretty="%H" -n1 HEAD
Failed to initialize global composer: Composer could not find the config file: /home/vagrant/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Running 1.2.0 (2016-07-19 01:28:52) with PHP 5.5.38-1~dotdeb+7.1 on Linux / 3.2.0-4-amd64
Loading composer repositories with package information
Downloading https://packagist.org/packages.json
Writing /home/vagrant/.composer/cache/repo/https---packagist.org/packages.json into cache
Updating dependencies (including require-dev)
Reading /home/vagrant/.composer/cache/repo/https---packagist.org/p-provider-2013.json from cache
Reading /home/vagrant/.composer/cache/repo/https---packagist.org/p-provider-2014.json from cache
Reading /home/vagrant/.composer/cache/repo/https---packagist.org/p-provider-2015.json from cache
Reading /home/vagrant/.composer/cache/repo/https---packagist.org/p-provider-2015-10.json from cache
Reading /home/vagrant/.composer/cache/repo/https---packagist.org/p-provider-2016-01.json from cache
Reading /home/vagrant/.composer/cache/repo/https---packagist.org/p-provider-2016-04.json from cache
Reading /home/vagrant/.composer/cache/repo/https---packagist.org/p-provider-2016-07.json from cache
Reading /home/vagrant/.composer/cache/repo/https---packagist.org/p-provider-archived.json from cache
Reading /home/vagrant/.composer/cache/repo/https---packagist.org/p-provider-latest.json from cache
Resolving dependencies through SAT
Dependency resolution completed in 0.001 seconds
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package rondobley/extended-respect-validation could not be found in any version, there may be a typo in the package name.
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.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
The package seems to be fine to me:
https://packagist.org/packages/rondobley/extended-respect-validation
It is a new package, just published today, but it has been several hours. I have also tried composer clearcache and that does not help. I have read many of the other similar issues here with no luck. I am new to publishing composer packages, so maybe I an missing a simple step?
Ideally I would like to install version ^1.0.
Thanks for the help in advance.
See https://twitter.com/packagist/status/772034610632990720 - it was a temporary failure on packagist

Laravel 4 - Composer could not load package

I am trying to update composer in a Laravel 4 project, but I get this error:
[RuntimeException] Could not load package psy/psysh in
http://packagist.org: [UnexpectedValueException] Could not parse
version constraint ^2.4.2: Invalid version string "^2.4.2"
I haven't used psy/psysh within my project. Why is this returned? How can I solve this and run composer update?
The ^ character in version strings is a relatively new composer feature. Update your version of the package manager and you should be good to go
composer self-update

Class sentinel.groups does not exist

After I made a composer update, I get this error:
Class sentinel.groups does not exist
Any suggestions?
Using: Laravel with Cartalyst Platform and Sentinel.
If you need to see some code, let me know.
Removing cartalyst/sentinel (dev-master 6749d28)
Installing cartalyst/sentinel (dev-master 08d5c12)
Downloading: 100%
you need to pull in the changes from the Platform repository or apply these changes https://github.com/cartalyst/platform/commit/08fcd8b00bf1c0cd8bdca7fb6990dc168c2a02da on your composer.json manually, after that you can run composer update and it should work as normal.

Resources