Laravel 8 passport 安装失败

问题描述 投票:0回答:4

我尝试通过运行

composer require laravel/passport
安装 laravel/passport 并且它给了我错误提示:

Your requirements could not be resolved to an installable set of packages.



Problem 1
    - lcobucci/jwt 4.2.x-dev requires ext-sodium * -> the requested PHP extension sodium is missing from your system.
    - lcobucci/jwt 4.1.x-dev requires ext-sodium * -> the requested PHP extension sodium is missing from your system.
    - lcobucci/jwt 4.1.0 requires ext-sodium * -> the requested PHP extension sodium is missing from your system.
    - Conclusion: don't install laravel/passport v10.1.0
    - Conclusion: remove lcobucci/jwt 3.3.3
    - Installation request for laravel/passport ^10.1 -> satisfiable by laravel/passport[10.x-dev, v10.1.0].
    - Conclusion: don't install lcobucci/jwt 3.3.3
    - laravel/passport 10.x-dev requires lcobucci/jwt ^3.4|^4.0 -> satisfiable by lcobucci/jwt[3.4.0, 3.4.1, 3.4.2, 3.4.3, 3.4.x-dev, 4.0.0, 4.0.0-alpha1, 4.0.0-alpha2, 4.0.0-alpha3, 4.0.0-beta1, 4.0.1, 4.0.x-dev, 4.1.0, 4.1.x-dev, 4.2.x-dev].
    - Can only install one of: lcobucci/jwt[3.4.0, 3.3.3].
    - Can only install one of: lcobucci/jwt[3.4.1, 3.3.3].
    - Can only install one of: lcobucci/jwt[3.4.2, 3.3.3].
    - Can only install one of: lcobucci/jwt[3.4.3, 3.3.3].
    - Can only install one of: lcobucci/jwt[3.4.x-dev, 3.3.3].
    - Can only install one of: lcobucci/jwt[4.0.0, 3.3.3].
    - Can only install one of: lcobucci/jwt[4.0.0-alpha1, 3.3.3].
    - Can only install one of: lcobucci/jwt[4.0.0-alpha2, 3.3.3].
    - Can only install one of: lcobucci/jwt[4.0.0-alpha3, 3.3.3].
    - Can only install one of: lcobucci/jwt[4.0.0-beta1, 3.3.3].
    - Can only install one of: lcobucci/jwt[4.0.1, 3.3.3].
    - Can only install one of: lcobucci/jwt[4.0.x-dev, 3.3.3].
    - Installation request for lcobucci/jwt (locked at 3.3.3) -> satisfiable by lcobucci/jwt[3.3.3].

  To enable extensions, verify that they are enabled in your .ini files:
    - C:\xampp\php\php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, reverting ./composer.json to its original content.

我在 SO 中看到一些解决方案说像这样向 laravel/passport 添加一些版本:

composer require laravel/passport:7.5.1
,但我不确定这是否适用于 laravel 8

laravel-passport laravel-8
4个回答
3
投票

您可以取消注释 php.ini 文件中的“sodium”扩展


2
投票

我在将 Laravel 应用程序作为操作系统部署到 EC2 AMI2 时遇到了同样的问题。我是我刚刚安装了 ext-sodium 使用:

sudo yum install php-sodium

1
投票

只需删除 composer.lock 文件并运行

composer install
命令 再次。别忘了谢谢我:)

大多数情况下,问题由 composer 锁定文件生成,因此在设置项目之前将其删除


0
投票

问题1

  • lcobucci/jwt 4.2.x-dev 需要 ext-sodium * -> 您的系统中缺少请求的 PHP 扩展钠。

它看起来像扩展名:钠在你的 php.ini 文件中被评论 转到你的 php.ini 文件并取消注释,如果你使用 xampp 然后重新加载你的 apache 然后尝试再次运行 composer

© www.soinside.com 2019 - 2024. All rights reserved.