Laravel 在本地主机上运行php artisan serve命令时出错

Laravel 在本地主机上运行php artisan serve命令时出错,laravel,laravel-artisan,serve,Laravel,Laravel Artisan,Serve,我对php artisan serve命令有问题。我正在处理一个Laravel项目,当我从浏览器访问文件夹时,它工作正常,但当我运行php artisan serve命令时,它会显示以下错误: 警告: require(E:\xampp\htdocs\www\LFS\public../vendor/autoload.php):失败 要打开流:中没有这样的文件或目录 第24行的E:\xampp\htdocs\www\LFS\public\index.php 致命错误:require():无法打开所需

我对
php artisan serve
命令有问题。我正在处理一个Laravel项目,当我从浏览器访问文件夹时,它工作正常,但当我运行
php artisan serve
命令时,它会显示以下错误:

警告: require(E:\xampp\htdocs\www\LFS\public../vendor/autoload.php):失败 要打开流:中没有这样的文件或目录 第24行的E:\xampp\htdocs\www\LFS\public\index.php

致命错误:require():无法打开所需的“E:\xampp\htdocs\www\LFS\public../vendor/autoload.php” (包括_path='E:\xampp\php\PEAR')在 第24行的E:\xampp\htdocs\www\LFS\public\index.php

我是拉雷维尔的新手,请告诉我哪里出了问题

我已经检查了public/index.php文件中的代码,下面是我的代码。我想一切都很好,我只是在我的根文件夹上复制粘贴相同的index.php文件

<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <taylor@laravel.com>
 */

define('LARAVEL_START', microtime(true));

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/

require __DIR__.'../vendor/autoload.php';

/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/

$app = require_once __DIR__.'../bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

$kernel->terminate($request, $response);

在项目文件夹中,缺少供应商文件夹,因此出现以下错误:

警告: require(E:\xampp\htdocs\www\LFS\public../vendor/autoload.php):失败 打开流:没有这样的文件或目录

只需运行以下命令:

composer update --no-scripts 
composer update

使用此命令,您将在项目中重新创建供应商文件夹

是否运行了composer安装?此外,如果您想使用php artisan serve来启动服务器(以防万一您不知道),则无需将项目放入htdocs文件夹中。不要复制粘贴任何index.php文件。laravel“root”文件夹是公用文件夹,而不是项目根目录。默认情况下,serve命令使用端口8000,您应该访问您的网站。但是,如果您想使用默认的http端口,请使用命令
php artisan serve--port 80
。是的,我使用了composer安装命令,它安装了所有的软件包。实际上,我正在使用pusher构建聊天系统,我也在使用Vue js,但当我在bootstrap.js文件中打开控制台时,我遇到了相同的错误。因此我想我的聊天系统不能实时工作。否则,一切正常,但我需要重新加载页面以获取新消息。我的项目中有供应商文件夹,我以前运行过composer update命令,它会在我的项目根目录上创建供应商文件夹。