繁体   English   中英

Laravel 8 供应商/lcobucci/jwt/src/Configuration.php 错误

[英]Laravel 8 error on vendor/lcobucci/jwt/src/Configuration.php

语法错误,意外的 'Parser' (T_STRING),期望 function (T_FUNCTION) 或 const (T_CONST)","异常":"ParseError",vendor/lcobucci/jwt/src/Configuration.php","line":22

我安装了 PHP 8.0 和 composer v2.0。

该项目完美地使用 xampp 在本地工作,但在 Digtalocean 上的 Ubuntu 20.04、nginx 配置中显示此错误

我有同样的错误,导致 500 内部服务器错误。

通过添加"lcobucci/jwt": "^3.3.3"到我的composer.json 。json 解决了这个问题。

这主要是依赖问题,首先我在我的composer.json和我的 laravel/framework 从 8.22.1 到 8.21.0 中将我的 laravel/passport 从 10.1 降级到 10.0,因为它当时工作正常。


vm:~$ php -v
PHP 7.4.13 (cli) (built: Nov 28 2020 06:24:43) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies

我的composer.json现在看起来像这样,


"laravel/framework": "^8.14",
"laravel/passport": "^10.1",
"lcobucci/jwt": "^3.3.3",


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

  Problem 1
    - Conclusion: don't install laravel/passport v10.1.0
    - Installation request for laravel/passport ^10.1 -> satisfiable by laravel/passport[10.x-dev, v10.1.0].
    - Conclusion: remove lcobucci/jwt 3.3.3
    - laravel/passport 10.x-dev requires lcobucci/jwt ^3.4|^4.0 -> satisfiable by lcobucci/jwt[3.4.x-dev, 4.0.x-dev, 4.1.x-dev].
    - Can only install one of: lcobucci/jwt[3.4.x-dev, 3.3.3].
    - Can only install one of: lcobucci/jwt[4.0.x-dev, 3.3.3].
    - Can only install one of: lcobucci/jwt[4.1.x-dev, 3.3.3].
    - Installation request for lcobucci/jwt 3.3.3 -> satisfiable by lcobucci/jwt[3.3.3].

添加


Updating dependencies (including require-dev)
Package operations: 0 installs, 4 updates, 0 removals
  - Updating lcobucci/jwt (3.3.3 => 3.4.2): Loading from cache
  - Updating league/oauth2-server (8.1.1 => 8.2.4): Loading from cache
  - Updating laravel/framework (v8.21.0 => v8.22.1): Loading from cache
  - Updating laravel/passport (v10.0.0 => v10.1.0): Loading from cache

现在它工作得很好,你可以在这里找到更多细节

我做了composer install --no-plugins并为我修复了错误。

我有同样的问题,并用作曲家更新修复了它。 你也可以试试。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM