laravel composer install could not solve installable package for tymon/jwt-auth

不羁的心 提交于 2019-12-02 04:20:26

问题


I am trying to run composer install for a laravel project. The error is as below:

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for namshi/jose 5.0.2 -> satisfiable by namshi/jose[5.0.2].
    - namshi/jose 5.0.2 requires lib-openssl * -> the requested linked library openssl has the wrong version installed or is missing from your system, make sure to have the extension providing it.
  Problem 2
    - namshi/jose 5.0.2 requires lib-openssl * -> the requested linked library openssl has the wrong version installed or is missing from your system, make sure to have the extension providing it.
    - tymon/jwt-auth 0.5.9 requires namshi/jose 5.0.* -> satisfiable by namshi/jose[5.0.2].
    - Installation request for tymon/jwt-auth 0.5.9 -> satisfiable by tymon/jwt-auth[0.5.9].

I looked into that, it seems that PHP in my Mac doesn't have openSSL. But when I run

php -m

There is openssl module in the list.

Hence, I don't understand what the problem is.

Here is my 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.*",
    "tymon/jwt-auth": "0.5.*",
    "barryvdh/laravel-ide-helper": "^2.1",
    "fzaninotto/faker": "~1.4",
    "zizaco/entrust": "~2.0"
},
"require-dev": {

    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~4.0",
    "phpspec/phpspec": "~2.1"
},
"autoload": {
    "classmap": [
        "database",
        "app/Services"

    ],
    "psr-4": {
        "App\\": "app/"
    }
},
"autoload-dev": {
    "classmap": [
        "tests/TestCase.php"
    ]
},
"scripts": {
    "post-install-cmd": [
        "php artisan clear-compiled",
        "php artisan optimize"
    ],
    "pre-update-cmd": [
        "php artisan clear-compiled"
    ],
    "post-update-cmd": [
        "php artisan optimize"
    ],
    "post-root-package-install": [
        "php -r \"copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
        "php artisan key:generate"
    ]
},
"config": {
    "preferred-install": "dist"
}

}

PS: I just got a brand new Mac pro, haven't got time to install MAMP and Xcode, so I guess the php I used is internally built


回答1:


Solved:

Install openSSL, curl, homebrew and php 5.6+ will resolve the problem.

Mac terminal commands:

brew install homebrew/php/php56 --with-homebrew-curl --with-openssl

composer require tymon/jwt-auth:0.5.*




回答2:


After searching and trying for hours, I made my way to solve this problem. The issue is because my macbook is the new one, no configuration at all, all the settings are default, including the php which is built in PHP.

After install MAMP, link the built php to MAMP php, then the problem is solved.

I guess built in PHP only has some basic modules, so, it is not compatible as the PHP from MAMP.

Refer to this post about how to link to MAMP PHP.



来源:https://stackoverflow.com/questions/37322446/laravel-composer-install-could-not-solve-installable-package-for-tymon-jwt-auth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!