Laravel 5 无法打开所需的引导程序/../vendor/autoload.php

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28468625/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 23:52:53  来源:igfitidea点击:

Laravel 5 Failed opening required bootstrap/../vendor/autoload.php

phplaravel-5

提问by Scott

I have recently installed Laravel 5 via composer. I tried creating a new controller using artisan and I get the following error:

我最近通过作曲家安装了 Laravel 5。我尝试使用 artisan 创建一个新控制器,但出现以下错误:

bootstrap/../vendor/autoload.php. Failed to open stream: No such file or directory. The "vendor" folder does not exist.

bootstrap/../vendor/autoload.php。无法打开流:没有这样的文件或目录。“供应商”文件夹不存在。

Am I missing something?

我错过了什么吗?

采纳答案by Scott

Turns out I didn't enable openssl in my php.ini so when I created my new project with composer it was installed from source. I changed that and ran

原来我没有在我的 php.ini 中启用 openssl 所以当我用 Composer 创建我的新项目时,它是从源代码安装的。我改变了,然后跑了

composer update

now the vendor folder was created.

现在已经创建了供应商文件夹。

回答by Shubhamoy

Run composer with --no-scripts

使用 --no-scripts 运行 composer

composer update --no-scripts  

This shall fix the issue. I tried this on Mac and Linux.

这将解决问题。我在 Mac 和 Linux 上试过这个。

回答by MONTS_MIND_Hacker

Which OS you are using ? For Windows : Go to Command Prompt

您使用的是哪个操作系统?对于 Windows:转到Command Prompt

set path to www/{ur project}

设置路径 www/{ur project}

For me : www/laravel5

为了我 : www/laravel5

Then type this command : composer install

然后输入这个命令: composer install

It will automatically install all dependency in vendor/

它将自动安装所有依赖项 vendor/

回答by dan-klasson

Run composer installin your root project folder (or php composer.phar install).

运行composer install在你的项目根文件夹(或php composer.phar install)。

回答by Dimitri Acosta

Did you create a new project or did you clone an existing project?

您是创建了一个新项目还是克隆了一个现有项目?

If you cloned an existing project it's very important to run

如果您克隆了现有项目,那么运行非常重要

composer install

That way all the dependencies that are missing will be installed.

这样,所有缺少的依赖项都将被安装。

But if you create a new project you should run this command to make a new project using composer

但是如果你创建一个新项目,你应该运行这个命令来使用 composer 创建一个新项目

composer create-project laravel/laravel name-of-your-project

回答by naveddeshmukh

I encountered the same problem. It occurred because composer was not able to install the dependencies specified in composer.json file. try running

我遇到了同样的问题。这是因为 composer 无法安装在 composer.json 文件中指定的依赖项。尝试跑步

composer install 

If this does not solve the problem, make sure the following php modules are installed php-mbstring php-dom

如果这不能解决问题,请确保安装了以下 php 模块 php-mbstring php-dom

To install this extensions run the following in terminal

要安装此扩展,请在终端中运行以下命令

sudo apt-get install php-mbstring php-dom

once the installation is complete

安装完成后

try running the command in your project root folder

尝试在项目根文件夹中运行命令

composer install 

回答by Williem

Just run this inside the directory where you installed your project

只需在安装项目的目录中运行它

composer install

回答by Hamid Parchami

You need to regenerate autoload.phpfile. you can use dump-autoloadto do that without having to go through an install or update.

您需要重新生成autoload.php文件。您可以使用它dump-autoload来执行此操作,而无需进行安装或更新。

use

composer dump-autoload

to generate autoload.phpfile again in /vendordirectory.

autoload.php/vendor目录中再次生成文件。

回答by RASEL RANA

Following this below step solved my problem. You may try

按照以下步骤解决了我的问题。你可以试试

composer update --no-scripts 
composer update

回答by Hashmat Waziri

After checking phpversion and a lot of research , the problem was on Composerside so just run the following command

在检查php版本和大量研究后,问题出在Composer一边,所以只需运行以下命令

composer install --ignore-platform-reqs

composer install --ignore-platform-reqs