警告:无法打开流:第 17 行的 C:\wamp\www\laravel\bootstrap\autoload.php 中没有这样的文件或目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21363829/
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 04:04:44  来源:igfitidea点击:

Warning: failed to open stream: No such file or directory in C:\wamp\www\laravel\bootstrap\autoload.php on line 17

phpmysqllaravel-4

提问by zogo

Environement

环境

  • Windows 7
  • WAMP server
    • PHP 5.3.13
    • Apache 2.2.12
    • MySQL 5.5.24
  • Laravel 4.1
  • Windows 7的
  • WAMP服务器
    • PHP 5.3.13
    • 阿帕奇 2.2.12
    • MySQL 5.5.24
  • Laravel 4.1

I installed laravel, trying to run the URL

我安装了 Laravel,试图运行 URL

http://localhost/laravel/public 

autoload.php

自动加载.php

define('LARAVEL_START', microtime(true));
require __DIR__.'/../vendor/autoload.php';

if (file_exists($compiled = __DIR__.'/compiled.php')){
    require $compiled;
}

Illuminate\Support\ClassLoader::register();

if (is_dir($workbench = __DIR__.'/../workbench')){
    Illuminate\Workbench\Starter::start($workbench);
}

I am facing the following errors:

我面临以下错误:

Warning: require(C:\wamp\www\laravel\bootstrap/../vendor/autoload.php) [function.require]: failed to open stream: No such file or directory in C:\wamp\www\laravel\bootstrap\autoload.php on line 17

警告:require(C:\wamp\www\laravel\bootstrap/../vendor/autoload.php) [function.require]: failed to open stream: No such file or directory in C:\wamp\www\laravel\第 17 行的 bootstrap\autoload.php

and

Fatal error: require() [function.require]: Failed opening required 'C:\wamp\www\laravel\bootstrap/../vendor/autoload.php' (include_path='.;C:\php\pear') in C:\wamp\www\laravel\bootstrap\autoload.php on line 17

致命错误:require() [function.require]:无法打开所需的 'C:\wamp\www\laravel\bootstrap/../vendor/autoload.php' (include_path='.;C:\php\pear')在 C:\wamp\www\laravel\bootstrap\autoload.php 第 17 行

回答by user2092317

Go to the current Project folder

转到当前项目文件夹

C:\wamp\www\laravelProjectFolder>

and type composer installin command prompt and press ENTERkey.

并输入composer install命令提示符并按ENTER键。

composer install

Then the vendordirectory will be downloaded in the current project of laravel. Now refresh the screen.

然后该vendor目录会被下载到laravel的当前项目中。现在刷新屏幕。

回答by Osei-Bonsu Christian

Simply make your storage folder writable. This can be found in your app directory

只需使您的存储文件夹可写。这可以在您的应用程序目录中找到

In your terminal use this command

在您的终端中使用此命令

chmod +w <directory> or chmod a+w <directory>

Make sure you navigate to the directory containing the directory you want to make writable or you point to that path.

确保导航到包含要使其可写的目录的目录,或者指向该路径。

回答by saadk

go to your project folder via cmd. run the following command

通过 cmd 转到您的项目文件夹。运行以下命令

composer update

it will install missing vendor folder and files in your project.

它将在您的项目中安装缺少的供应商文件夹和文件。

but in some cases it gives error like " Your configuration does not allow connection to bla bla bla.."

但在某些情况下,它会给出诸如“您的配置不允许连接到 bla bla bla ..”之类的错误。

for that go to your composer.jsonfile,

为此,请转到您的composer.json文件,

change "secure-http": trueto "secure-http": false

更改"secure-http": true"secure-http": false

but in some cases (as was in my case) you may not find such line in your file. for that do the following action:

但在某些情况下(如我的情况),您可能在文件中找不到这样的行。为此,请执行以下操作:

change "config": { "preferred-install": "dist" }

改变 "config": { "preferred-install": "dist" }

to

"config": {
    "preferred-install": "dist",
    "secure-http": false
}

and run again composer updatecommand.

并再次运行composer update命令。

hope this will solve problem of many persons. :)

希望这能解决很多人的问题。:)

回答by Axel Amthor

You are trying to include:

您正在尝试包括:

C:\wamp\www\laravel\bootstrap/../vendor/autoload.php

and the error gives

并且错误给出

No such file or directory in 
         C:\wamp\www\laravel\bootstrap\autoload.php on line 17

so you need to check your directory layout. Is there a directory vendorin lavarelwith a file autoload.phpin it?

所以你需要检查你的目录布局。是否有一个目录vendorlavarel有一个文件autoload.php中呢?

and you should either have /in your pathnames or \but not mixed both.

并且您应该/在路径名中包含或\但不要将两者混合。