Laravel 8 vendor/lcobucci/jwt/src/Configuration 错误。php
Laravel 8 error on vendor/lcobucci/jwt/src/Configuration.php
语法错误,意外的 'Parser' (T_STRING),期待函数 (T_FUNCTION) 或 const (T_CONST)",“异常” : "ParseError", vendor/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
解决了这个问题。
这主要是依赖性问题,首先我将 composer.json
中的 laravel/passport 从 10.1 降级到 10.0
我的 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
现在一切正常,你可以找到more details here
我做了 composer install --no-plugins
,它为我修复了错误。
我遇到了同样的问题,并通过 composer update 修复了它。你也可以试试吗
语法错误,意外的 'Parser' (T_STRING),期待函数 (T_FUNCTION) 或 const (T_CONST)",“异常” : "ParseError", vendor/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
解决了这个问题。
这主要是依赖性问题,首先我将 composer.json
中的 laravel/passport 从 10.1 降级到 10.0
我的 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
现在一切正常,你可以找到more details here
我做了 composer install --no-plugins
,它为我修复了错误。
我遇到了同样的问题,并通过 composer update 修复了它。你也可以试试吗