所以,我从Bitbucket导入了另一个项目并尝试使用php artisan serve
启动它,我总是收到此错误:
[LogicException]
Key path "file:///var/www/html/DesignViewer5/storage/oauth-private.key" does not
exist or is not readable
当我自己创建项目时,我没有收到此错误,我无法运行任何其他命令。我试过'php artisan key:generate',并得到完全相同的错误。
我试过了:composer update
,并得到了这个:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Updating spatie/laravel-permission (1.11.1 => 1.12.0) Downloading: 100%
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
[LogicException]
Key path "file:///var/www/html/DesignViewer5/storage/oauth-private.key" doe
s not exist or is not readable
Script php artisan optimize handling the post-update-cmd event returned with error code 1
任何人都知道如何修复它?谢谢!
答案 0 :(得分:11)
我认为这是由于Laravel Passport,你应该尝试以下命令:
php artisan passport:install
此命令将创建生成安全所需的加密密钥 访问令牌。此外,该命令将创建“个人访问” 以及将用于生成访问权限的“密码授予”客户端 令牌
答案 1 :(得分:3)
由于.gitignore
位于php artisan passport:keys
中,因此如果您拉项目,则可能会因为运行{{1}}而丢失了密钥,将为您生成新的密钥。
答案 2 :(得分:3)
我已经删除了这一点:Passport::loadKeysFrom(__DIR__.'/../secrets/oauth');
来自 App\Providers\AuthServiceProvider
并解决了该问题。
https://laravel.com/docs/8.x/passport#deploying-passport
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
Passport::routes();
Passport::loadKeysFrom(__DIR__.'/../secrets/oauth');
}
答案 3 :(得分:3)
答案 4 :(得分:1)
执行此命令
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000000000090000, pid=10320, tid=140491055642368
#
# JRE version: Java(TM) SE Runtime Environment (8.0_66-b17) (build 1.8.0_66-b17)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.66-b17 mixed mode linux-amd64 )
# Problematic frame:
# C 0x0000000000090000
#
# Core dump written. Default location: /opt/CSCOlumos/core or core.10320
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
#
--------------- T H R E A D ---------------
Current thread (0x00007fc5a0f60000): JavaThread "http-nio-443-exec-39" daemon [_thread_in_Java, id=1520, stack(0x00007fc69f6f3000,0x00007fc69f774000)]
siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000090000
Registers:
RAX=0x00007fc754276be0, RBX=0x00007fc5ef526f68, RCX=0x0000000000000006, RDX=0x00007fcb0ea9e188
RSP=0x00007fc69f770bc0, RBP=0x0000000000000007, RSI=0x00007fcb0ea9e188, RDI=0x00007fc69f770b40
R8 =0x0000000000090000, R9 =0x00007fcb0358d000, R10=0x0000000000000000, R11=0x00007fcb18a69600
R12=0x00007fc5b9f27f20, R13=0x00007fc754276be0, R14=0x00007fc69f770820, R15=0x00007fc5a0f60000
RIP=0x0000000000090000, EFLAGS=0x0000000000010206, CSGSFS=0x0000000000000033, ERR=0x0000000000000014
TRAPNO=0x000000000000000e
Top of Stack: (sp=0x00007fc69f770bc0)
0x00007fc69f770bc0: 00007fc754274938 00007fc7542727d8
0x00007fc69f770bd0: 00007fc7542727d8 00007fcb18c6e1e9
0x00007fc69f770be0: 00007fc5a0f60000 00007fcb0d642ef8
0x00007fc69f770bf0: 00007fc5a0f60000 00007fcb035949b0
0x00007fc69f770c00: 00007fc69f770c68 00007fcb03594670
0x00007fc69f770c10: 00007fcb03594670 00007fc754274938
0x00007fc69f770c20: 00007fc7542727d8 00007fc69f770c28
0x00007fc69f770c30: 00007fc5daf2d079 00007fc69f770c98
0x00007fc69f770c40: 00007fc5daf2d838 00007fc5b7d11e80
0x00007fc69f770c50: 00007fc5daf2d108 00007fc69f770c18
0x00007fc69f770c60: 00007fc69f770c90 00007fc69f770ce0
0x00007fc69f770c70: 00007fcb035949b0 0000000000000000
0x00007fc69f770c80: 00007fc754274938 00007fc7542748e0
0x00007fc69f770c90: 0000000000001000 00007fc7542727d8
0x00007fc69f770ca0: 00007fc69f770ca0 00007fc5daf2cecc
0x00007fc69f770cb0: 00007fc69f770d10 00007fc5daf2d838
0x00007fc69f770cc0: 00007fc5b7d11ce8 00007fc5daf2cf20
0x00007fc69f770cd0: 00007fc69f770c90 00007fc69f770d00
0x00007fc69f770ce0: 00007fc69f770d58 00007fcb035949b0
0x00007fc69f770cf0: 00007fc7542727d8 0000000000000000
0x00007fc69f770d00: 00007fc84956a4b8 0000000000001000
0x00007fc69f770d10: 00007fc754251018 00007fc69f770d18
0x00007fc69f770d20: 00007fc5daf2cd35 00007fc69f770d70
0x00007fc69f770d30: 00007fc5daf2d838 00007fc5b7d123e0
0x00007fc69f770d40: 00007fc5daf2cd60 00007fc69f770d00
0x00007fc69f770d50: 00007fc69f770d68 00007fc69f770db8
0x00007fc69f770d60: 00007fcb035949b0 00007fc84956a4b8
0x00007fc69f770d70: 00007fc754251018 00007fc69f770d78
0x00007fc69f770d80: 00007fc5f4ff6819 00007fc69f770df8
0x00007fc69f770d90: 00007fc5f4ff6e18 00007fc5b7d11aa8
0x00007fc69f770da0: 00007fc5f4ff6888 00007fc69f770d68
0x00007fc69f770db0: 00007fc69f770e00 00007fc75426fd60
Instructions: (pc=0x0000000000090000)
0x000000000008ffe0:
[error occurred during error reporting (printing registers, top of stack, instructions near pc), id 0xb]
Register to memory mapping:
RAX=
[error occurred during error reporting (printing register info), id 0xb]
Stack: [0x00007fc69f6f3000,0x00007fc69f774000], sp=0x00007fc69f770bc0, free space=502k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C 0x0000000000090000
答案 5 :(得分:1)
第1步:
仅在
oauth-private.key
和oauth-public.key
中不存在的情况下运行 存储文件夹,否则跳过第一步。.
php artisan passport:install
第2步:
清除配置并生成密钥
php artisan config:clear
php artisan key:generate
php artisan config:clear
第3步:
这样更改权限和所有者:
sudo chown www-data:www-data storage/oauth-*.key
sudo chmod 600 storage/oauth-*.key
答案 6 :(得分:0)
我找到了解决方案 的解决方案:强> 在config / app.php中,我不得不评论这些行:
/*Laravel\Passport\PassportServiceProvider::class,
App\Providers\CodeGrantProvider::class,
Spatie\Permission\PermissionServiceProvider::class,*/
您需要再次迁移整个数据库, 取消注释这一行:
Laravel\Passport\PassportServiceProvider::class,
运行php artisan passport:install
我的应用程序密钥不起作用,所以我必须这样做:
php artisan config:clear
php artisan key:generate
php artisan config:clear
而且我能做php artisan serve
谢谢!
答案 7 :(得分:0)
我在更新作曲家时遇到了同样的问题。我再次使用 php artisanpassport:keys 生成了密钥,并解决了问题
答案 8 :(得分:0)
不要执行此行,直到在文件的特定位置有键为止
在AuthServiceProvider.php中
// Passport :: loadKeysFrom('/ secret-keys / oauth');
答案 9 :(得分:0)
如果你已经安装了passpord并且没有配置运行这个命令,那么示例
php artisan passport:keys
如果还没有安装passport包,你必须在Laravel docs中查看passpord的文档