laravel composer install 无法解决 tymon/jwt-auth 的可安装包
Posted
技术标签:
【中文标题】laravel composer install 无法解决 tymon/jwt-auth 的可安装包【英文标题】:laravel composer install could not solve installable package for tymon/jwt-auth 【发布时间】:2016-09-16 06:54:42 【问题描述】:我正在尝试为 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 pro,还没来得及安装MAMP和Xcode,所以估计我用的php是内建的
【问题讨论】:
尝试用phpinfo()
创建一个小的php脚本,看看是否有OpenSSL。
【参考方案1】:
已解决:
安装 openSSL、curl、homebrew 和 php 5.6+ 即可解决问题。
Mac 终端命令:
brew install homebrew/php/php56 --with-homebrew-curl --with-openssl
composer require tymon/jwt-auth:0.5.*
【讨论】:
【参考方案2】:经过几个小时的搜索和尝试,我设法解决了这个问题。 问题是因为我的macbook是新的,根本没有配置,所有的设置都是默认的,包括php内置的php。
安装好MAMP后,将编译好的php链接到MAMP php,问题就解决了。
我猜 PHP 内置的只有一些基本模块,所以它与 MAMP 的 PHP 不兼容。
请参阅这篇关于how to link to MAMP PHP 的帖子。
【讨论】:
在尝试更新作曲家时这对我不起作用。我刚刚升级到 El Capitan 并遇到了这个问题。与 Vagrant 和 Laravel Homestead 一起使用 - 现在一切正常 我正在使用 Homestead,但仍然遇到了这个问题。原来问题是我在 host 机器上使用作曲家,而不是在 Homestead...以上是关于laravel composer install 无法解决 tymon/jwt-auth 的可安装包的主要内容,如果未能解决你的问题,请参考以下文章
laravel4 composer install 得到 proc_open 不可用错误
PHP Laravel Install and Quickstart
laravel composer install 无法解决 tymon/jwt-auth 的可安装包
laravel根目录下如何解决在composer install时提示php版本需要更新?
Laravel 5.3 在 ubuntu16.04 nginx 中使用命令 composer install --no-dev 上传