ali
ali

Reputation: 23

Install a new libary in Yii 2 via composer

I have a problem in yii 2 installing libary via composer. I want to install yii2-kartikgii (warrence/yii2-kartikgii) into my yii 2.

I do the instruction and add "warrence/yii2-kartikgii": "dev-master" to my composer.jason and then in terminal (I use PHP Strom and I use the terminal of that) I write composer update but when I did that it gives me this ERROR :

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 - yiisoft/yii2 2.0.9 requires bower-asset/jquery 2.2.@stable | 2.1.@stable | 1.11.@stable | 1.12.@stable -> no matching package found.
- yiisoft/yii2 2.0.8 requires bower-asset/jquery 2.2.@stable | 2.1.@stable | 1.11.@stable -> no matching package found.
- yiisoft/yii2 2.0.7 requires bower-asset/jquery 2.2.
@stable | 2.1.@stable | 1.11.@stable -> no matching package found.
- yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.@stable | 1.11.@stable -> no matching package found.
- yiisoft/yii2 2.0.9 requires bower-asset/jquery 2.2.@stable | 2.1.@stable | 1.11.@stable | 1.12.@stable -> no matching package found.
- Installation request for yiisoft/yii2 >=2.0.6 -> satisfiable by yiisoft/yii2[2.0.6, 2.0.7, 2.0.8, 2.0.9].

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.

Even when I do not add "warrence/yii2-kartikgii": "dev-master" and just update composer that error is shown!

What should I do to fix this?

Here is my composer.jason file and I use Yii2 Advanced.

{
        "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": "*"
        },
        "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"
            }
        },
        "scripts": {
            "post-install-cmd": "php init --env=Development --overwrite=n"
        } }

Upvotes: 0

Views: 738

Answers (1)

Vladyslav Startsev
Vladyslav Startsev

Reputation: 379

As @Bizley said first run

composer global require "fxp/composer-asset-plugin:*"

then if you got

Could not fetch https://api.github.com/repos/jquery/jquery-dist , please create a GitHub OAuth token to go over the API rate limit Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+sass+2016-10-11+1612 to retrieve a token. It will be stored in "C:/Users/aLi/AppData/Roaming/Composer/auth.json" for future use by Composer. Token (hidden):

  1. go to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+sass+2016-10-11+1612
  2. at the buttom of the page you will see green button "Generate token", click on that.

3.copy token from the field and pass it to cli where it said Token (hidden):

4.Press "Enter"

It will resume your download

there is actully link on github how to generate tokens https://help.github.com/articles/creating-an-access-token-for-command-line-use/

Upvotes: 1

Related Questions