laravel composer install 无法解决 tymon/jwt-auth 的可安装包

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

我正在尝试 运行 composer 安装 laravel 项目。 错误如下:

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].

我调查了一下,我的 Mac 中的 PHP 似乎没有 openSSL。 但是当我 运行

php -m

列表中有openssl模块。

因此,我不明白问题是什么。

这是我的 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: 我刚买了一个全新的 Mac pro,还没来得及安装 MAMP 和 Xcode,所以我猜我用的 php 是内置的

经过数小时的搜索和尝试,我找到了解决此问题的方法。 问题是因为我的macbook是新的,根本没有配置,所有设置都是默认的,包括PHP中内置的php。

安装MAMP后,link将内置的php转为MAMPphp,问题解决。

我猜 PHP 中内置的只有一些基本模块,因此它与 MAMP 中的 PHP 不兼容。

参考这个post关于how to link to MAMP PHP

已解决:

安装 openSSL、curl、自制软件和 php 5.6+ 将解决问题。

Mac 终端命令:

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

composer require tymon/jwt-auth:0.5.*