繁体   English   中英

Laravel-无法运行工匠命令

[英]Laravel - Unable to run artisan command

今天,我打开了Laravel 5.4的一个旧项目(我认为),我想对其进行一些编辑,以便将其全部保存,但是在运行任何artisan命令时,我收到了写在控制台(cmd)上的巨大错误。

<?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/

$app = new Illuminate\Foundation\Application(
    realpath(__DIR__.'/../')
);

/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/

$app->singleton(
    Illuminate\Contracts\Http\Kernel::class,
    App\Http\Kernel::class
);

$app->singleton(
    Illuminate\Contracts\Console\Kernel::class,
    App\Console\Kernel::class
);

$app->singleton(
    Illuminate\Contracts\Debug\ExceptionHandler::class,
    App\Exceptions\Handler::class
);

/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/

return $app;
PHP Fatal error:  Uncaught Error: Call to a member function make() on integer in C:\Users\admin\Desktop\mywebsite\website\artisan:31
Stack trace:
#0 {main}
  thrown in C:\Users\admin\Desktop\mywebsite\website\artisan on line 31

看起来像一个php文件的整个内容,然后下面的错误

PHP Fatal error:  Uncaught Error: Call to a member function make() on integer in C:\Users\admin\Desktop\mywebsite\website\artisan:31
    Stack trace:
    #0 {main}
      thrown in C:\Users\admin\Desktop\mywebsite\website\artisan on line 31

我只是遇到这种错误,然后我发现我的某些文件特别是bootstrap / app.php损坏了,为什么它显示了一些奇怪的字符。

OP进入php聊天室寻求帮助。 经过一些调试后,发现问题是由于缺少.env文件,导致应用程序无法正确构建。

对于OP,可以通过将_env重命名为.env并确保将APP_KEY设置为有效的长度和内容来解决此问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM