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

时间:2016-05-19 11:54:39

标签: laravel composer-php osx-elcapitan

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

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专业版,没有时间安装MAMP和Xcode,所以我猜我用的是内置的php

2 个答案:

答案 0 :(得分:2)

解决:

安装openSSL,curl,homebrew和php 5.6+将解决问题。

Mac终端命令:

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

composer require tymon/jwt-auth:0.5.*

答案 1 :(得分:1)

经过几个小时的搜索和尝试,我找到了解决这个问题的方法。 问题是因为我的macbook是新的,没有任何配置,所有的设置都是默认的,包括用PHP构建的php。

安装MAMP后,将构建的php链接到MAMP php,然后问题解决了。

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

请参阅有关how to link to MAMP PHP的帖子。