[英]Laravel Composer could not install tymon/jwt-auth
Please assist, composer could not install tymon/jwt-auth:0.5.*请协助,作曲家无法安装 tymon/jwt-auth:0.5.*
I had type:我有类型:
composer require tymon/jwt-auth:0.5.*
i also tried to add the ff in projects composer.json:我还尝试在项目composer.json中添加ff:
require {
....
"tymon/jwt-auth": "dev-master",
....
}
and "tymon/jwt-auth": "0.5.*" respectively和 "tymon/jwt-auth": "0.5.*" 分别
Plase note: I am new to laravel...请注意:我是 laravel 的新手...
In the case of laravel 9.11:在 laravel 9.11 的情况下:
Typing this command:键入此命令:
composer require tymon/jwt-auth
OutPut an Error: OutPut 出现错误:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires tymon/jwt-auth ^0.5.12 -> satisfiable by tymon/jwt-auth[0.5.12].
- tymon/jwt-auth 0.5.12 requires illuminate/support ~5.0 -> found illuminate/support[v5.0.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
This command worked for me in Laravel 8 to Laravel 9.11:这个命令在 Laravel 8 到 Laravel 9.11 中对我有用:
composer require -w tymon/jwt-auth --ignore-platform-reqs
composer.json作曲家.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.0.2",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^9.11",
"laravel/sanctum": "^2.14.1",
"laravel/tinker": "^2.7",
"tymon/jwt-auth": "^1.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
I found a (temporary) solution.我找到了一个(临时)解决方案。
To get Laravel 5.8 compatibility, perform:要获得 Laravel 5.8 兼容性,请执行:
composer require tymon/jwt-auth ^1.0.0-rc.4.1
See discussion in this Github issue .请参阅此 Github 问题中的讨论。
To install this package you will need:
要安装此软件包,您需要:
Laravel 4 or 5 (see compatibility table) PHP 5.4 +
Install via composer - edit your composer.json to require the package.
通过 composer 安装 - 编辑您的 composer.json 以要求该软件包。
"require": { "tymon/jwt-auth": "0.5.*" }
Then run
composer update
in your terminal to pull it in.然后在终端中运行
composer update
以将其拉入。
The installation is there https://github.com/tymondesigns/jwt-auth/wiki/Installation There is nothing said about dev-master
, try with 0.5.*
安装在那里https://github.com/tymondesigns/jwt-auth/wiki/Installation没有关于
dev-master
的说法,尝试使用0.5.*
According to this Github issue根据这个 Github issue
composer require tymon/jwt-auth --ignore-platform-reqs
Worked for me perfectly完美地为我工作
使用“--ignore-platform-reqs”
composer require tymon/jwt-auth --ignore-platform-reqs
You may get a 0.5 version by a simple : composer require tymon/jwt-auth
您可以通过简单的方式获得 0.5 版本:
composer require tymon/jwt-auth
To specify from 0.5, you may use composer require tymon/jwt-auth:^0.5
要从 0.5 开始指定,您可以使用
composer require tymon/jwt-auth:^0.5
To install the tymon/jwt-auth package in PHP laravel, one should follow the following steps:要在 PHP laravel 中安装 tymon/jwt-auth 包,应遵循以下步骤:
Composer.json require should be like this: Composer.json 要求应该是这样的:
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"tymon/jwt-auth": "0.5.*"
},
Then in config/app.php put the following in the providers array:然后在 config/app.php 中将以下内容放入 providers 数组中:
Tymon\JWTAuth\Providers\JWTAuthServiceProvider::class
Then in the aliases array in the config/app.php add the following然后在 config/app.php 的 aliases 数组中添加以下内容
'JWTAuth' => Tymon\JWTAuthFacades\JWTAuth::class,
'JWTFactory' => Tymon\JWTAuthFacades\JWTFactory::class
Then type the following command:然后键入以下命令:
php artisan vendor:publish
Note: Various tutorial will suggest you the following php artisan vendor:publish --provider="Tymon\JWTAuthProviders\JWTAuthServiceProvider" but befor that try the above command ie without --provider and it will work注意:各种教程会建议您使用以下 php artisan vendor:publish --provider="Tymon\JWTAuthProviders\JWTAuthServiceProvider" 但在此之前尝试上述命令,即不带 --provider 它将起作用
Then type:然后输入:
php artisan jwt:generate
After this step you can verify the generated key in app/config/jwt.php as mentioned below:完成此步骤后,您可以验证 app/config/jwt.php 中生成的密钥,如下所述:
'secret' => env('JWT_SECRET', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'),
Laravel 8:
composer require tymon/jwt-auth:^1.0.2
composer require tymon/jwt-auth --ignore-platform-reqs
npm install --save jwt-simple
完美地为我工作。
according to my idea better use below command.根据我的想法,最好使用以下命令。 composer require tymon/jwt-auth --ignore-platform-reqs
作曲家需要 tymon/jwt-auth --ignore-platform-reqs
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.