Extension not getting installed through composer in cpanel - yii2

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.

Related

Composer dependency from own forked repository

I have gitlab repository https://gitlab.com/ajkosh/yii2-admin and below is my composer.json:
{
"name": "haruatari/yii2-module-app",
"description": "Empty module application on Yii2",
"minimum-stability": "stable",
"license": "MIT",
"authors": [
{
"name": "Viktor Pikaev",
"email": "haruatari#gmail.com",
"homepage": "http://haru-atari.com/about"
}
],
"repositories": [
{
"type": "vcs",
"url": "git#github.com:ajkosh/yii2-admin.git"
}
],
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "2.0.15",
"yiisoft/yii2-bootstrap": "~2.0.0",
"yiisoft/yii2-swiftmailer": "~2.0.0",
"paulzi/yii2-materialized-path": "^2.0",
"kartik-v/yii2-widget-select2":"2.0.4",
"ajkosh/yii2-admin": "dev"
},
"require-dev": {
"codeception/codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*"
},
"config": {
"fxp-asset": {
"installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
},
"process-timeout": 1800},
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::postCreateProject"
]
},
"extra": {
"yii\\composer\\Installer::postCreateProject": {
"setPermission": [
{
"runtime": "0777",
"web/assets": "0777",
"data": "0777",
"data/log": "0777",
"data/tmp": "0777",
"yii": "0755"
}
],
"generateCookieValidationKey": [
"config/web.php"
]
}
}
}
I am trying to fetch yii2-admin from my own repository but I am getting below error when I am running composer update.
Problem 1
- The requested package ajkosh/yii2-admin 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.
- 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.
You're using incorrect package name. On resolving dependencies package name in URL is irrelevant, the only name what matters is package name in composer.json. So Composer reads composer.json from your forked repository, and finds name mdmsoft/yii2-admin, because you don't changed it after forking. There is no ajkosh/yii2-admin at all. You should either update package name in composer.json in your fork:
{
"name": "ajkosh/yii2-admin",
"description": "RBAC Auth manager for Yii2 ",
"keywords": ["yii", "admin", "auth", "rbac"],
"type": "yii2-extension",
...
Or use source package name in your require section:
"require": {
...
"mdmsoft/yii2-admin": "dev-master"
},

Composer always download the fontend assets

Every time I used composer installed extension to Yii2,it always download the frontend assets.Its so slow!How can I fix this?
This is what Composer download,every time I install the extension
This is 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": "~2.0.0",
"yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0",
"dmstr/yii2-adminlte-asset": "2.*",
"ijackua/yii2-lepture-markdown-editor-widget": "dev-master",
"aliyuncs/oss-sdk-php": "^2.2",
"yiichina/yii2-md-editor": "*"
},
"require-dev": {
"yiisoft/yii2-debug": "~2.0.0",
"yiisoft/yii2-gii": "~2.0.0",
"yiisoft/yii2-faker": "~2.0.0",
"codeception/base": "^2.2.3",
"codeception/verify": "~0.3.1"
},
"config": {
"process-timeout": 1800
},
"repositories": {
"0": {
"type": "composer",
"url": "https://packagist.phpcomposer.com"
},
"packagist": {
"type": "composer",
"url": "https://packagist.laravel-china.org"
}
}
}
This is the issue with fxp/composer-asset-plugin which Yii2 uses in order to download NPM as well as Bower assets. Each time a new library is added the plugin will enumerate all the versions of NPM as well as Bower assets required by the project hence downloading lots of data from Github. Official Yii2 developers are considering to move to a better alternative package manager for NPM as well as Bower like https://asset-packagist.org/ as discussed here https://github.com/yiisoft/yii2/issues/13064

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

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