Laravel - "artisan tinker" -> mkdir(): 权限被拒绝

Laravel - "artisan tinker" -> mkdir(): Permission denied

我现在已经搜索了几个小时,但找不到解决方案,即使那里有类似的问题。

我正尝试 运行 php artisan tinker 与用户 webmaster(项目目录 demo 的所有者)进行全新 laravel 安装,但是我收到以下错误:

In Configuration.php line 352:
mkdir(): Permission denied

运行 详细标志:

Exception trace: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() at n/a:n/a mkdir() at /media/usb/drive1/websites/demo/vendor/psy/psysh/src/Psy/Configuration.php:352 Psy\Configuration->getRuntimeDir() at /media/usb/drive1/websites/demo/vendor/psy/psysh/src/Psy/Shell.php:185 Psy\Shell->getDefaultCommands() at /media/usb/drive1/websites/demo/vendor/symfony/console/Application.php:1211 Symfony\Component\Console\Application->init() at /media/usb/drive1/websites/demo/vendor/symfony/console/Application.php:435 Symfony\Component\Console\Application->add() at /media/usb/drive1/websites/demo/vendor/psy/psysh/src/Psy/Shell.php:134 Psy\Shell->add() at /media/usb/drive1/websites/demo/vendor/symfony/console/Application.php:421 Symfony\Component\Console\Application->addCommands() at /media/usb/drive1/websites/demo/vendor/laravel/tinker/src/Console/TinkerCommand.php:54 Laravel\Tinker\Console\TinkerCommand->handle() at n/a:n/a call_user_func_array() at /media/usb/drive1/websites/demo/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:29 Illuminate\Container\BoundMethod::Illuminate\Container{closure}() at /media/usb/drive1/websites/demo/vendor/laravel/framework/src/Illuminate/Container/ BoundMethod.php:87 Illuminate\Container\BoundMethod::callBoundMethod() at /media/usb/drive1/websites/demo/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:31 Illuminate\Container\BoundMethod::call() at /media/usb/drive1/websites/demo/vendor/laravel/framework/src/Illuminate/Container/Container.php:549 Illuminate\Container\Container->call() at /media/usb/drive1/websites/demo/vendor/laravel/framework/src/Illuminate/Console/Command.php:183 Illuminate\Console\Command->execute() at /media/usb/drive1/websites/demo/vendor/symfony/console/Command/Command.php:252 Symfony\Component\Console\Command\Command->run() at /media/usb/drive1/websites/demo/vendor/laravel/framework/src/Illuminate/Console/Command.php:170 Illuminate\Console\Command->run() at /media/usb/drive1/websites/demo/vendor/symfony/console/Application.php:938 Symfony\Component\Console\Application->doRunCommand() at /media/usb/drive1/websites/demo/vendor/symfony/console/Application.php:240 Symfony\Component\Console\Application->doRun() at /media/usb/drive1/websites/demo/vendor/symfony/console/Application.php:148 Symfony\Component\Console\Application->run() at /media/usb/drive1/websites/demo/vendor/laravel/framework/src/Illuminate/Console/Application.php:88 Illuminate\Console\Application->run() at /media/usb/drive1/websites/demo/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:121 Illuminate\Foundation\Console\Kernel->handle() at /media/usb/drive1/websites/demo/artisan:37

希望有人能给我提示。谢谢!

相关信息

报告的类似问题

问这个问题已经一年了。我只是忽略了修补程序的使用不足并继续。但今天我终于找到了解决方案,并认为分享可能是个好主意。

共享服务器环境可能导致此错误。从文件 vendor/psy/psysh/src/Configuration.php 的第 352 行转储变量 $this->runtimeDir 告诉我缺少在 /run/user/1000/psysh 中创建文件夹的权限,其中 1000 是 uid。

解决方法是告诉 psysh 使用操作用户具有写入权限的目录。这可以通过 runtimeDir 配置选项来完成。您需要做的就是在 ~/.config/psysh/config.php 中或在 Laravel 的项目根目录中本地创建一个配置文件 .psysh.php。添加以下内容,您就可以开始了。

<?php
return [
    'runtimeDir' => './.psysh',
];