Composer error: Could not parse version constraint >=~2 - yii2

Friends, when trying to run the
composer update
the following error appears:
C:\wamp\www\mysystem>composer update Loading composer repositories
with package information Updating dependencies (including require-dev)
[UnexpectedValueException] Could not parse version constraint
=~2: Invalid version string "~2"
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev]
[--no-dev] [--lock] [--no-custom-installers] [--no-autoloader]
[--no-scripts] [--no-progress] [--no
-suggest] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative]
[--apcu-autoloader] [--ignore-platform-reqs] [--p refer-stable]
[--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [
]...
Here is my composer.json file:
{
"license": "BSD-3-Clause",
"minimum-stability": "stable",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.5",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"fxp/composer-asset-plugin": "~1.1.1",
"trntv/yii2-datetime-widget": "*",
"miloschuman/yii2-highcharts-widget": "dev-master",
"kartik-v/yii2-money": "*",
"kartik-v/yii2-slider": "*",
"kartik-v/yii2-widget-datepicker": "#dev",
"kartik-v/yii2-field-range": "*",
"kartik-v/yii2-widget-colorinput": "*",
"kartik-v/yii2-widget-sidenav": "#dev",
"kartik-v/yii2-export": "#dev",
"kartik-v/yii2-grid": "#dev",
"yiidoc/yii2-redactor": "*",
"tugmaks/yii2-google-maps": "dev-master",
"yiisoft/yii2-imagine": "^2.0",
"karpoff/yii2-crop-image-upload": "*",
"cyneek/yii2-menu": "dev-master",
"bupy7/yii2-widget-cropbox": "*",
"philippfrenzel/yii2fullcalendar": "*",
"kartik-v/yii2-widget-touchspin": "*"
},
"require-dev": {
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*"
},
"config": {
"process-timeout": 1800
},
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::postCreateProject"
]
},
"extra": {
"yii\\composer\\Installer::postCreateProject": {
"setPermission": [
{
"runtime": "0777",
"web/assets": "0777",
"yii": "0755"
}
],
"generateCookieValidationKey": [
"config/web.php"
]
},
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
}
}
I tried on w7 and ubuntu

Try to set old version fxp/composer-asset-plugin:
composer global require "fxp/composer-asset-plugin:1.0.1"
or install the newest one:
composer global require "fxp/composer-asset-plugin:dev-master"

Related

Extension not getting installed through composer in cpanel

I am using yii2 basic application template. I have VPS server for hosting my software. In my cpanel I have installed composer successfully. Then I uploaded my files from local machine to the server.
Now I want to do composer update in cpanel using Putty.
My composer is as below:
{
"name": "yiisoft/yii2-app-basic",
"description": "Yii 2 Basic Project Template",
"keywords": ["yii2", "framework", "basic", "project template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "stable",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.5",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"nex/yii2-datepicker": "*",
"kartik-v/yii2-mpdf": "*",
"wbraganca/yii2-dynamicform": "*",
"yiisoft/yii2-jui": "#dev",
"bupy7/yii2-dynamic-fields": "*",
"unclead/yii2-multiple-input": "v2.9.0",
"faryshta/yii2-disable-submit-buttons": "#dev",
"phpoffice/phpexcel": "#dev",
"mdmsoft/yii2-admin": "*"
},
"require-dev": {
"codeception/codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*"
},
"config": {
"process-timeout": 1800
},
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::postCreateProject"
]
},
"extra": {
"yii\\composer\\Installer::postCreateProject": {
"setPermission": [
{
"runtime": "0777",
"web/assets": "0777",
"yii": "0755"
}
],
"generateCookieValidationKey": [
"config/web.php"
]
},
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
}
}
Everything is fine, when I type the command composer update, it shows the below error
[ifsoftware1234#216-10-245-56 basic]$ composer update
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 nex/yii2-datepicker * -> satisfiable by nex/yii2-datepicker[dev-master].
- nex/yii2-datepicker dev-master requires bower-asset/eonasdan-bootstrap-datetimepicker 4.17.* -> 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.

UnexpectedValueException: Could not parse version constraint >=~2: Invalid version string "~2"

I'd tried:
composer global update
composer selfupdate
composer update
I got error at 3rd step.
I run php 7. Building a webpage use Yii2.
I had run "composer update" successfully in the past (as I remember, that is before updating php to 7)
Below is my composer.json
{
"name": "yiisoft/yii2-app-basic",
"description": "Yii 2 Basic Project Template",
"keywords": ["yii2", "framework", "basic", "project template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "dev",
"require": {
"php": ">=5.3.3",
"yiisoft/yii2": "*",
"yiisoft/yii2-authclient": "*",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"kartik-v/yii2-widget-datetimepicker": "*",
"kartik-v/yii2-widget-select2": "#dev",
"dektrium/yii2-user": "*",
"philippfrenzel/yii2fullcalendar": "*",
"kartik-v/yii2-widget-timepicker": "*",
"kartik-v/yii2-widget-depdrop": "#dev",
"wbraganca/yii2-dynamicform": "*",
"kartik-v/yii2-widgets": "*",
"kartik-v/yii2-grid": "#dev",
"kartik-v/yii2-mpdf": "dev-master",
"kartik-v/yii2-popover-x": "*",
"kartik-v/yii2-krajee-base": "dev-master",
"bluezed/yii2-scroll-top": "*",
"kartik-v/yii2-icons": "#dev",
"kartik-v/yii2-export": "*",
"kartik-v/yii2-field-range": "*",
"kartik-v/yii2-widget-typeahead": "*",
"fxp/composer-asset-plugin": "*",
"ext-gd": "*",
"codemix/yii2-streamlog": "^1.0",
"ext-intl": "*",
"yii2mod/yii2-google-maps-markers": "*",
"kartik-v/yii2-tabs-x": "*",
"kartik-v/yii2-editable": "*",
"kartik-v/yii2-money": "dev-master",
"yiisoft/yii2-imagine": "*",
"himiklab/yii2-recaptcha-widget": "*",
"aws/aws-sdk-php": "^3.20",
"aws/aws-php-sns-message-validator": "^1.1",
"doctrine/cache": "^1.6",
"fedemotta/yii2-aws-sdk": "*",
"loveorigami/yii2-notification-wrapper": "*",
"bower-asset/noty": "^2.3",
"bower-asset/jquery-growl": "^1.3"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*"
},
"config": {
"process-timeout": 1800
},
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::postCreateProject"
]
},
"extra": {
"yii\\composer\\Installer::postCreateProject": {
"setPermission": [
{
"runtime": "0777",
"web/assets": "0777",
"yii": "0755"
}
],
"generateCookieValidationKey": [
"config/web.php"
]
},
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
}
}
Thank you.
Exist a error with "philippfrenzel/yii2fullcalendar": "*"
You can check this error with composer update -vvv
You can see here: https://github.com/philippfrenzel/yii2fullcalendar/issues/76
Use this to resolve temporaly:
$ composer global require fxp/composer-asset-plugin:~1.3#dev
After this if you obtain another error when you try to execute composer similar to this:
Changed current directory to /Users/xxxx/.composer
Fatal error: Call to undefined method Composer\Package\RootPackage::getConfig() in /Users/xxxx/.composer/vendor/fxp/composer-asset-plugin/Util/Config.php on line 125
To fixed this you only remove the folder: sudo rm -rf /Users/xxxx/.composer

Yii2 composer update (install) eats all memory

When I trying to update composer in project i have a problem with memory limit and can't update it.
I have tried to install composer globally and locally but it same.
The fxp/composer-asset-plugin:^1.2.0 was installed globally.
If -d memory_limit = -1 it eat all RAM memory and freezes,
if I set memory_limit to 2GB or 4GB I just get memory limit error,
I have this problem on 3 different Yii2 projects and on a different PC
(MacOS, Ubuntu 14.04, Ubuntu 16.04). Right now I don't have any idea how to solve this problem.
Here is composer.json one of my projects:
{
"name": "yiisoft/yii2-app-advanced",
"description": "Yii 2 Advanced Application Template",
"keywords": ["yii2", "framework", "advanced", "application template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "stable",
"require": {
"php": ">=5.4.0",
"fxp/composer-asset-plugin": "*",
"yiisoft/yii2": "*",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"yiisoft/yii2-mongodb": "*",
"google/apiclient": "1.0.*#beta",
"bower-asset/admin-lte": "~1.0",
"dmstr/yii2-adminlte-asset": "2.*",
"bower-asset/font-awesome": "~4.0",
"kartik-v/yii2-widgets": "*",
"mobiledetect/mobiledetectlib": "*",
"kartik-v/yii2-icons": "*",
"kartik-v/yii2-widget-datepicker": "#dev",
"kop/yii2-scroll-pager": "dev-master",
"nirvana-msu/yii2-infinite-scroll": "1.0.*#dev",
"himiklab/yii2-recaptcha-widget": "*",
"yiisoft/yii2-jui": "~2.0",
"bower-asset/angular": "*",
"bower-asset/angular-route": "*",
"bower-asset/angular-strap": "*",
"2amigos/yii2-chartjs-widget" : "~2.0",
"kartik-v/yii2-date-range": "dev-master",
"yiisoft/yii2-imagine": "^2.0",
"2amigos/yii2-tinymce-widget": "~1.1",
"2amigos/yii2-ckeditor-widget": "~1.0",
"kartik-v/bootstrap-fileinput": "#dev",
"shiyang/yii2-masonry": "*",
"shiyang/yii2-infinite-scroll": "*",
"bower-asset/masonry": "~3.2",
"bower-asset/imagesloaded": "*",
"bower-asset/eventemitter": "4.*",
"2amigos/yii2-gallery-widget": "~1.0",
"philippfrenzel/yii2masonry": "*",
"kartik-v/yii2-grid": "#dev",
"2amigos/yii2-file-upload-widget": "~1.0",
"newerton/yii2-fancybox": "dev-master",
"facebook/php-sdk-v4": "^5.1",
"kartik-v/yii2-sortable": "*",
"serhatozles/yii2-simplehtmldom": "dev-master",
"mailgun/mailgun-php": "~1.7.2",
"geoip2/geoip2": "~2.0",
"bower-asset/clipboard": "*"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*"
},
"config": {
"process-timeout": 1800
},
"extra": {
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
},
"asset-repositories": [
{
"name": "bower-asset/eventemitter",
"type": "bower-vcs",
"url": "git://github.com/Wolfy87/EventEmitter.git"
}
]
}
}

Fxp\Composer\AssetPlugin\Repository\NpmRepository does not exist

i installed latest version(1.0.3) of "fxp/composer-asset-plugin" and it now is
"fxp/composer-asset-plugin": "~1.0.3"
but when i run any command it gives me this error
[ReflectionException] Class Fxp\Composer\AssetPlugin\Repository\NpmRepository does not exist
[ErrorException] Declaration of Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRepository::whatProvides() should be compatible with Composer\Repository\ComposerRepository::whatProvides(Composer\DependencyResolver\Pool $pool, $name, $bypassFilters = false)
i run this command (php composer.phar global update fxp/composer-asset-plugin) but still this error occur!
and when i run this command (composer global require fxp/composer-asset-plugin --no-plugins) it show me
Nothing to install or update
Here's my composer.json
{
"name": "yiisoft/yii2-app-advanced",
"description": "Yii 2 Advanced Project Template",
"keywords": ["yii2", "framework", "advanced", "project template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "stable",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.6",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"wbraganca/yii2-dynamicform": "*",
"fxp/composer-asset-plugin": "~1.0.3",
"faravaghi/yii2-jalali-datepicker": "*",
"farsidesign/yii2-jalali-datepicker": "dev-master",
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*"
},
"config": {
"process-timeout": 1800
},
"extra": {
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
}
}
Latest fxp/composer-asset-plugin version is 1.1.4.
Remove plugin and install latest version. And don't forget update composer to last version.

Updating composer throws exception Class Fxp\Composer\AssetPlugin\Repository\NpmRepository does not exist

I recently ran latest composer installation for a Yii2 basic application template.
But running php composer.phar install throws this exception:
Class Fxp\Composer\AssetPlugin\Repository\NpmRepository does not
exist
The "yiisoft/yii2-composer" plugin requires composer-plugin-api 1.0.0,
this WIL L break in the future and it should be fixed ASAP (require
^1.0 for example).
[ReflectionException] Class
Fxp\Composer\AssetPlugin\Repository\NpmRepository does not exist
[ErrorException]
Declaration of
Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRepository::w
hatProvides() should be compatible with
Composer\Repository\ComposerRepository::
whatProvides(Composer\DependencyResolver\Pool $pool, $name,
$bypassFilters = fal se)
Here is my composer.json:
{
"name": "yiisoft/yii2-app-basic",
"description": "Yii 2 Basic Project Template",
"keywords": ["yii2", "framework", "basic", "project template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "stable",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.5",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*"
},
"config": {
"process-timeout": 1800
},
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::postCreateProject"
]
},
"extra": {
"yii\\composer\\Installer::postCreateProject": {
"setPermission": [
{
"runtime": "0777",
"web/assets": "0777",
"yii": "0755"
}
],
"generateCookieValidationKey": [
"config/web.php"
]
},
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
}
}
What could have gone wrong? Anyone experiencing this?
Like the error message says:
The "yiisoft/yii2-composer" plugin requires composer-plugin-api 1.0.0, this WILL break in the future and it should be fixed ASAP (require ^1.0 for example).
Try to update your fxp/composer-asset-plugin:
php composer.phar global update fxp/composer-asset-plugin --no-plugins
PS: If after update it still not working, try also following:
composer global require fxp/composer-asset-plugin --no-plugins