laravel 运行“Composer Install”后丢失“vendor”文件夹
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/47186191/
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
"vendor" folder missing after running "Composer Install"
提问by Carlo Teran
I am currently trying to run on Vagrant/Homestead a Laravel Application that I pulled from Github. I connected it to the database, and run Composer Install, Composer Update inside the folder. When I try to access to it on the Browser I get the following error:
我目前正在尝试在 Vagrant/Homestead 上运行我从 Github 中提取的 Laravel 应用程序。我将它连接到数据库,并在文件夹内运行 Composer Install、Composer Update。当我尝试在浏览器上访问它时,出现以下错误:
Warning: require(/home/vagrant/.../public/vendor/autoload.php): failed to open stream: No such file or directory in /home/vagrant/..../public/autoload.php on line 2
警告:需要(/home/vagrant/.../public/vendor/autoload.php):无法打开流:/home/vagrant/..../public/autoload.php 中没有这样的文件或目录在线2
I navigated to the vendor folder and noticed that it was not created. Any ideas how to fix it?
我导航到供应商文件夹并注意到它没有被创建。任何想法如何解决它?
The application runs in Laravel 4, and I got the following output from the terminal when I run Composer Install:
该应用程序在 Laravel 4 中运行,当我运行 Composer Install 时,我从终端获得了以下输出:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Package herrera-io/json is abandoned, you should avoid using it. Use kherge/json instead.
Package kherge/version is abandoned, you should avoid using it. No replacement was suggested.
Package herrera-io/phar-update is abandoned, you should avoid using it. No replacement was suggested.
Package mjolnic/bootstrap-colorpicker is abandoned, you should avoid using it. Use itsjavi/bootstrap-colorpicker instead.
Generating autoload files
生成自动加载文件
php artisan clear-compiled php artisan optimize Generating optimized class loader
php artisan clear-compiled php artisan optimize 生成优化的类加载器
Any ideas?
有任何想法吗?
采纳答案by Niraj Shah
Composer needs to be run from the root of your application, i.e. not from the public
folder as your error seems to indicate.
Composer 需要从您的应用程序的根目录运行,即不是从public
您的错误似乎表明的文件夹中运行。
You can first try running:
您可以先尝试运行:
composer install --no-scripts
This command should list the packages that are being downloaded and installed. If the above works, you can then run:
此命令应列出正在下载和安装的软件包。如果上述方法有效,则可以运行:
php artisan optimize
This will create the autoload.php file that Laravel will use.
这将创建 Laravel 将使用的 autoload.php 文件。
回答by Collins Benson
I also experienced that, i solved the problem by creating a vendor/bin folder inside the Composer directory.
我也遇到过,我通过在 Composer 目录中创建一个 vendor/bin 文件夹解决了这个问题。
$PATH/users/*-system_name-*/AppData/Roaming/Composer