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

匿名 (未验证) 提交于 2019-12-03 01:29:01

问题:

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

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

Am I missing something?

回答1:

Run composer with --no-scripts

composer update --no-scripts   

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



回答2:

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

set path to www/{ur project}

For me : www/laravel5

Then type this command : composer install

It will automatically install all dependency in vendor/



回答3:

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



回答4:

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

composer update 

now the vendor folder was created.



回答5:

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 create-project laravel/laravel name-of-your-project 


回答6:

Just run this inside the directory where you installed your project

composer install 


回答7:

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

composer install  

If this does not solve the problem, make sure the following php modules are installed 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  


回答8:

Following this below step solved my problem. You may try

composer update --no-scripts  composer update 


回答9:

After checking php version and a lot of research , the problem was on Composer side so just run the following command

composer install --ignore-platform-reqs



回答10:

When the new project created the laravel require to load vendors to autoload the libraries , We use composer update to

composer update 

Composer is a dependency manager allows you to delegate responsibility for managing your dependencies to a third party.



回答11:

Just setup a new project using composer instead of laravel like this:

composer create-project --prefer-dist laravel/laravel myProje 


回答12:

Just run the following commands,

composer update 

Or

composer install 


回答13:

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

use

composer dump-autoload 

to generate autoload.php file again in /vendor directory.



回答14:

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

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.." in cmd.

for that go to your composer.json file,

change "secure-http": true to "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" }

to

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

and run again composer update command.

hope this will solve problem of many persons. :)



回答15:

Before you carry out the following instructions you need to make sure you have composer installed globally on your machine; Open you Mac terminal and run the following command:

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer 

once composer is installed globally run the following command after you are in the directory of the project:

composer install 

once completed in it update and install all the required packages.



回答16:

I also had that error. But none of the above solved the issue. So i uninstalled and again installed the composer. Then i did composer update. and the problem was fixed.



回答17:

I added composer.lock file to .gitignore, after commit that file to repository error is gone :)



回答18:

I had same problem with laravel and artisan, the solution:

php artisan key:generate 


回答19:

I got this when I did composer update instead of composer install.



回答20:

In my case I had to enable another extension, namely php_mbstring.dll in the php.ini file before it could work. It's listed under extension=php_mbstring.dll. Find it in the php.ini file and remove the semi-colon (;) in front of it and save the file.

After this run install composer again in the root directory of your Laravel applcication and is should work.



回答21:

If you are a Windows user you may uninstall Composer. Then install Composer. After that you install Laravel. Maybe it will work.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!