简体   繁体   中英

Can't install Dingo with Laravel

I just removed my installed laravel folder in which I installed Dingo and JWT easily. Laravel version was 5.2.x.

Now, whenever I try to reinstall Dingo API it gives me error. Here is the list of commands I used:

Steps to Install

  1. Install Laravel: composer create-project laravel/laravel citycare 5.2.* . (I have also tried with 5.1.*)
  2. Install Dingo: composer require dingo/api:1.0.x@dev .

Here is the error

You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
./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
    - Conclusion: don't install dingo/api 1.0.x-dev
    - Conclusion: don't install dingo/api v1.0.0-beta3
    - Conclusion: remove laravel/framework v5.2.38
    - Installation request for phpdocumentor/reflection-docblock == 3.1.0.0 -> satisfiable by phpdocumentor/reflection-docblock[3.1.0].
    - Conclusion: don't install laravel/framework v5.2.38
    - dingo/api v1.0.0-beta1 requires illuminate/support 5.1.* -> satisfiable by illuminate/support[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.6, v5.1.8].
    - dingo/api v1.0.0-beta2 requires illuminate/support 5.1.* -> satisfiable by illuminate/support[v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.6, v5.1.8].
    - don't install illuminate/support v5.1.1|don't install laravel/framework v5.2.38
    - don't install illuminate/support v5.1.13|don't install laravel/framework v5.2.38
    - don't install illuminate/support v5.1.16|don't install laravel/framework v5.2.38
    - don't install illuminate/support v5.1.2|don't install laravel/framework v5.2.38
    - don't install illuminate/support v5.1.20|don't install laravel/framework v5.2.38
    - don't install illuminate/support v5.1.22|don't install laravel/framework v5.2.38
    - don't install illuminate/support v5.1.25|don't install laravel/framework v5.2.38
    - don't install illuminate/support v5.1.28|don't install laravel/framework v5.2.38
    - don't install illuminate/support v5.1.30|don't install laravel/framework v5.2.38
    - don't install illuminate/support v5.1.31|don't install laravel/framework v5.2.38
    - don't install illuminate/support v5.1.6|don't install laravel/framework v5.2.38
    - don't install illuminate/support v5.1.8|don't install laravel/framework v5.2.38
    - Installation request for laravel/framework == 5.2.38.0 -> satisfiable by laravel/framework[v5.2.38].
    - Installation request for dingo/api 1.0.x@dev -> satisfiable by dingo/api[1.0.x-dev, v1.0.0-beta1, v1.0.0-beta2, v1.0.0-beta3].


Installation failed, reverting ./composer.json to its original content.

Andrey B, I tried that but that doesn't worked for me. Apparently, I decided to go ahead and try some more things in order to make it work. And here is the solution that I found:

I added "phpdocumentor/reflection": "3.x@dev" under "require": { } in composer.json and ran a composer update .

After this, composer require ran successfully.

I am still unable to find what caused this problem. I guess, last time I installed, the composer.json already had phpdocumentor inside it.

Have a look at my new composer.json :

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.1.*",
        "phpdocumentor/reflection": "3.x@dev",
        "dingo/api": "1.0.x@dev",
        "zizaco/entrust": "5.2.x-dev"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1",
        "laracasts/generators": "^1.1"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

And also note I am using Laravel 5.1.x .

I've just experienced the same issue. Installing via composer require command failed, but editing composer.json file and then running composer update worked just fine.

Solved:

Add "phpdocumentor/reflection": "3.x@dev" under "require": in composer.json

"require": { "php": ">=5.5.9", "laravel/framework": "5.2.*", "phpdocumentor/reflection": "3.x@dev" },

$ composer update $ composer require dingo/api:1.0.x@dev

after successful command this will add "dingo/api": "1.0.x@dev" under "require":.

"require": { "php": ">=5.5.9", "laravel/framework": "5.2.*", "phpdocumentor/reflection": "3.x@dev", "dingo/api": "1.0.x@dev" }

I'm working with laravel 5.4, I faced same issue while I tried to import through terminal using this command. " composer require dingo/api:1.0.x@dev "..... but after that I just updated my composer.json file and it was like this

"require": {
        "php": ">=5.6.4",
        "dingo/api": "1.0.*@dev",
        "laravel/framework": "5.4.*",
        "laravel/tinker": "~1.0",
        "intervention/image": "dev-master"
    }

Afterward I run "composer update" command and package imported successfully helping link: https://github.com/dingo/api/wiki/Installation

You can use this for Dingo Installation

"require": {
    "dingo/api": "2.0.0-alpha1"
}

This approach works for me:

"require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.1.*",
        "phpdocumentor/reflection": "3.x@dev",
        "dingo/api": "1.0.x@dev"
    },
    
composer update
composer require dingo/api:1.0.x@dev

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM