使用 Laravel “警告:需要(C:\wamp\www\laravel\bootstrap/../vendor/autoload.php):无法打开流:没有这样的
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26132401/
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
Using Laravel "Warning:require(C:\wamp\www\laravel\bootstrap/../vendor/autoload.php): failed to open stream: No such
提问by Eddie Greathouse
I am new to laravel, composer, and windows terminal. I am trying to setup laravel on my local host. I currently have wamp installed and I have used it before to create basic websites. However, I am now doing a bigger project that needs a framework so I decided to learn Laravel. I installed composer as indicated in the directions, but when i run the command
我是 laravel、composer 和 windows 终端的新手。我正在尝试在本地主机上设置 Laravel。我目前已经安装了 wamp 并且我之前使用过它来创建基本网站。但是,我现在正在做一个需要框架的更大项目,所以我决定学习 Laravel。我按照说明安装了composer,但是当我运行命令时
"C:\wamp\www>composer create-project laravel/laravel laravel"
"C:\wamp\www>composer create-project laravel/laravel laravel"
i generate an error message that says
我生成了一条错误消息,上面写着
"[InvalidArgumentException] Project directory laravel/ is not empty."
“[InvalidArgumentException] 项目目录 laravel/ 不为空。”
When I open a browser and navigate to "localhost/laravel/public
" I encounter the error message from the title of this thread:
当我打开浏览器并导航到“ localhost/laravel/public
”时,我遇到了来自该线程标题的错误消息:
"Warning:require(C:\wamp\www\laravel\bootstrap/../vendor/autoload.php): failed to open stream: No such
“警告:需要(C:\wamp\www\laravel\bootstrap/../vendor/autoload.php):无法打开流:没有这样的
I have also added the appropriate environment variables from the composer instructions.
我还从 Composer 说明中添加了适当的环境变量。
I am really lost at this point, and I have spent the past 4 hours trying to debug this.
在这一点上我真的很迷茫,过去 4 个小时我一直在尝试调试它。
I am running Windows 8 x64.
我正在运行 Windows 8 x64。
Edit:
编辑:
I tried running composer install in C:\wamp\www and received an error message
我尝试在 C:\wamp\www 中运行 composer install 并收到一条错误消息
Composer could not find the config file: C:\ProgramData]ComposerSetup\bin Ti initialize a project, please create a composer.json file as described in the http://getcomposer.org/"Getting Started" section "
Composer 找不到配置文件:C:\ProgramData]ComposerSetup\bin Ti 初始化一个项目,请按照http://getcomposer.org/“入门”部分中的描述创建一个 composer.json 文件 “
回答by Rohan
The dependencies for your project are not installed. Just download composer from GetComposer.organd install it on your Windows Machine. Then navigate to your project root, you will see a composer.json file there. That file specifies all the dependencies of the project. Run composer update in that directory. Composer will then update or install all required dependencies and your application won't show the error then.
未安装项目的依赖项。只需从GetComposer.org下载 composer并将其安装在您的 Windows 机器上。然后导航到您的项目根目录,您将在那里看到一个 composer.json 文件。该文件指定了项目的所有依赖项。在该目录中运行 composer update 。然后 Composer 将更新或安装所有必需的依赖项,然后您的应用程序将不会显示错误。
cd \wamp\www\yourproject
composer update
回答by Eddie Greathouse
I figured it out! I was missing a folder called "vendor" and a file inside bootstrap called "compiled.php" Sorry for the inconvenience, and thank you for trying!
我想到了!我丢失了一个名为“vendor”的文件夹和一个名为“compiled.php”的引导程序中的文件,很抱歉给您带来不便,感谢您的尝试!
回答by srinivassree
use the following command to get vendor folder in your project
使用以下命令获取项目中的供应商文件夹
composer install --no-scripts
回答by ceejayoz
"C:\wamp\www>composer create-project laravel/laravel laravel"
"[InvalidArgumentException] Project directory laravel/ is not empty."
"C:\wamp\www>composer create-project laravel/laravel laravel"
“[InvalidArgumentException] 项目目录 laravel/ 不为空。”
This means C:\wamp\www\laravel
already existed when you attempted to run the command. Remove the folder, or change the create-project
command to use a different folder name for your new project.
这意味着C:\wamp\www\laravel
在您尝试运行命令时已经存在。删除文件夹,或更改create-project
命令以对新项目使用不同的文件夹名称。
"Warning:require(C:\wamp\www\laravel\bootstrap/../vendor/autoload.php): failed to open stream: No such
“警告:需要(C:\wamp\www\laravel\bootstrap/../vendor/autoload.php):无法打开流:没有这样的
You need to do a composer install
from C:\wamp\www\laravel
.
你需要做一个composer install
from C:\wamp\www\laravel
。
回答by wani
i had the same problem but i just ran this command
我有同样的问题,但我只是运行了这个命令
composer install
作曲家安装
to install all the dependencies
安装所有依赖项