[英]Laravel 8 error on vendor/lcobucci/jwt/src/Configuration.php
syntax error, unexpected 'Parser' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)", "exception": "ParseError", vendor/lcobucci/jwt/src/Configuration.php", "line": 22语法错误,意外的 'Parser' (T_STRING),期望 function (T_FUNCTION) 或 const (T_CONST)","异常":"ParseError",vendor/lcobucci/jwt/src/Configuration.php","line":22
I have PHP 8.0 and composer v2.0 installed.我安装了 PHP 8.0 和 composer v2.0。
The project work locally using xampp perfectly but showing this error in Ubuntu 20.04, nginx config on Digtalocean该项目完美地使用 xampp 在本地工作,但在 Digtalocean 上的 Ubuntu 20.04、nginx 配置中显示此错误
I had the same exact err, causing a 500 internal server error.我有同样的错误,导致 500 内部服务器错误。
by adding "lcobucci/jwt": "^3.3.3"
to my composer.json
fixed the issue.通过添加
"lcobucci/jwt": "^3.3.3"
到我的composer.json
。json 解决了这个问题。
It's mostly dependencies issue, first I downgraded my laravel/passport from 10.1 to 10.0 in my composer.json
and my laravel/framework from 8.22.1 to 8.21.0 as it was working fine at that point.这主要是依赖问题,首先我在我的
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
my composer.json
now looks like this,我的
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].
added添加
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
Now it's working just fine, you can find more details here现在它工作得很好,你可以在这里找到更多细节
I did composer install --no-plugins
and it fixed the error for me.我做了
composer install --no-plugins
并为我修复了错误。
i had the same problem and fixed it with composer update.我有同样的问题,并用作曲家更新修复了它。 May u try it too.
你也可以试试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.