Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
1
Help us understand the problem. What is going on with this article?
@kosawa

Laravel5.8でjwt-authをインストールできない

More than 1 year has passed since last update.

概要

対応ログ

jwtインストール

composer require tymon/jwt-auth

エラー内容

以下のようなエラーが発生し、インストールできない。

$ composer require tymon/jwt-auth
Using version ^0.5.12 for tymon/jwt-auth
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for tymon/jwt-auth ^0.5.12 -> satisfiable by tymon/jwt-auth[0.5.12].
    - Conclusion: remove nesbot/carbon 2.19.2
    - Conclusion: don't install nesbot/carbon 2.19.2
    - tymon/jwt-auth 0.5.12 requires nesbot/carbon ~1.0 -> satisfiable by nesbot/carbon[1.0.0, 1.0.1, 1.1.0, 1.10.0, 1.11.0, 1.12.0, 1.13.0, 1.14.0, 1.15.0, 1.16.0, 1.17.0, 1.18.0, 1.19.0, 1.2.0, 1.20.0, 1.21.0, 1.22.0, 1.22.1, 1.23.0, 1.24.0, 1.24.1, 1.24.2, 1.25.0, 1.25.1, 1.25.3, 1.26.0, 1.26.1, 1.26.2, 1.26.3, 1.26.4, 1.26.5, 1.26.6, 1.27.0, 1.28.0, 1.29.0, 1.29.1, 1.29.2, 1.3.0, 1.30.0, 1.31.0, 1.31.1, 1.32.0, 1.33.0, 1.34.0, 1.34.1, 1.34.2, 1.34.3, 1.34.4, 1.35.0, 1.35.1, 1.36.0, 1.36.1, 1.36.2, 1.37.0, 1.37.1, 1.38.0, 1.38.1, 1.38.2, 1.38.3, 1.38.4, 1.4.0, 1.5.0, 1.6.0, 1.7.0, 1.8.0, 1.9.0].
    - Can only install one of: nesbot/carbon[1.26.3, 2.19.2].
    - Can only install one of: nesbot/carbon[1.26.4, 2.19.2].
    - Can only install one of: nesbot/carbon[1.26.5, 2.19.2].
    - Can only install one of: nesbot/carbon[1.26.6, 2.19.2].
    - Can only install one of: nesbot/carbon[1.27.0, 2.19.2].
    - Can only install one of: nesbot/carbon[1.28.0, 2.19.2].
    - Can only install one of: nesbot/carbon[1.29.0, 2.19.2].
    - Can only install one of: nesbot/carbon[1.29.1, 2.19.2].
    - Can only install one of: nesbot/carbon[1.29.2, 2.19.2].
    ・
    ・
    ・
Installation failed, reverting ./composer.json to its original content.

原因

調査したところ、ちょこちょこ同様なイシューが上がっており、tymon/jwt-authのバージョンが低く、Carbonとの依存関係が解決しないらしい? :expressionless:

対応したこと

以下を追加する(バージョンはエラーを参考に設定する。

composer.json
"require": {
    "nesbot/carbon": "2.19.2 as 1.26.3",
}

対応していないこと

jwt-authのバージョンをあげることで対応できるらしいzo :smile:

composer require tymon/jwt-auth:^1.0

結局

providerにセットして、ミドルウェアを適用するために以下のコマンドを実行したら、バージョンで怒られたので、バージョンをあげた:relaxed:

php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"

バージョンをあげる

"require": {
    ...
    "tymon/jwt-auth": "^1.0.0-rc.3"
    ...
},
1
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
kosawa

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
1
Help us understand the problem. What is going on with this article?