供应商/lcobucci/jwt/src/Configuration.php上的Laravel8错误

语法错误,意外的“解析器”(T_STRING),需要函数(T_FUNCTION)或常量(T_CONST)”,“异常”:“ParseError”,供应商/lcobucci/jwt/src/Configuration.php”,“行”:22

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

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

回答

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

通过添加"lcobucci/jwt": "^3.3.3"到我composer.json修复的问题。

这主要是依赖问题,首先我将我的 laravel/passport 从 10.1 降级到 10.0,composer.json
并将我的 laravel/framework 从 8.22.1 降级到 8.21.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

现在它运行良好,您可以在此处找到更多详细信息


以上是供应商/lcobucci/jwt/src/Configuration.php上的Laravel8错误的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>