10

I have recently installed Laravel via Composer but I keep get the following error:

Warning: require(/home/leovoon/public_html/laravel-eee/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /home/leovoon/public_html/laravel-eee/bootstrap/autoload.php on line 17

Fatal error: require(): Failed opening required '/home/leovoon/public_html/laravel-eee/bootstrap/../vendor/autoload.php' (include_path='.:/opt/cpanel/ea-php71/root/usr/share/pear') in /home/leovoon/public_html/laravel-eee/bootstrap/autoload.php on line 17

Am I missing something? Because I followed it step by step.

enter image description here

8
  • can you provide the screnshot of the directory structure Commented Jan 4, 2019 at 5:32
  • @Manojkiran.A added Commented Jan 4, 2019 at 6:22
  • give read-write permission to the folder. Commented Jan 4, 2019 at 6:41
  • not in the local machine please provide the webserver screenshot Commented Jan 4, 2019 at 6:42
  • 1
    I miss the vendor folder on your image.... Commented Jan 4, 2019 at 7:22

6 Answers 6

14

You got an error because you have missing vendor folder in your project, You need /vendor because all your packages are there, including all the classes Laravel uses. The vendor directory contains your Composer dependencies.

Your problem can be resolved after following this step. you can try it:

composer update --no-scripts 
composer update

With this command, you will re-create the vendor folder in your project and after that your project will start working normally.

Sign up to request clarification or add additional context in comments.

Comments

3

While Going Live This is my Project Structure

NOTE:WHILE DOING THIS YOU MAY ENCOUNTER SOME STYLE AND JAVASCRIPT REFERENCE ERROR IF YOU ARE USNIG ASSET FUNCTION NO NEED TO WORRY

<link href="{{ asset('css/app.css') }}" rel="stylesheet">

BUT IF NOT IF WILL OCCUR 404 IN SOME CASES

this is Just For Example

Step 1 : create a folder named as `ProjectFiles` in root of your application

enter image description here

Step 2: copy all the contents except and folder except `public` folder and paste inside `ProjectFiles` folder

enter image description here

Step3: now cut and paste all the contents inside the public folder in root of your application root

enter image description here

step4: open your index.php file and make the following changes

require __DIR__.'/../vendor/autoload.php';

to

require __DIR__.'/ProjectFiles/vendor/autoload.php';

AND

$app = require_once __DIR__.'/../bootstrap/app.php';

to

$app = require_once __DIR__.'/ProjectFiles/bootstrap/app.php';

and then upload your project to live cpanel server

here is my cpanel server directory structure

hope it helps if the answer is not clear please comment below if the error continues

enter image description here

Comments

2

I got this error after trying to start the dev server using php artisan serve This is how I resolved it:

  1. Run composer install

In case you get an error like "Your requirements could not be resolved to an installable set of packages", make sure you have the necessary extensions enabled in your php.ini config. In my case I needed to enable extension=fileinfo

  1. Run composer update. After this you should be able to start the server with no errors.

Comments

1

Run composer with --no-scripts

composer update --no-scripts  

This shall fix the issue.

2 Comments

Warning: require_once(C:\xampp\htdocs\Laravel-Lumen-API-master\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\Laravel-Lumen-API-master\bootstrap\app.php on line 3 Fatal error: require_once(): Failed opening required 'C:\xampp\htdocs\Laravel-Lumen-API-master\bootstrap/../vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\Laravel-Lumen-API-master\bootstrap\app.php on line 3
After run the script, the issue still persists
1

You must provide Read and write permissions to your project and generate a key in your .env file

Run the following commands inside your project dir and you would be good to go :

$ sudo chmod -R 777 /storage /public /bootstrap

$ composer install

$ php artisan key:generate

1 Comment

You should be using 755, not 777!
-1

In my case the issue was a missing extension in my php-cli. Using Ubuntu 23 I had to call sudo apt install php-curl then I could call composer install and start the server.

5 Comments

That sounds pretty unsual. If the vendor folder is not present (as shown in the screenshot), it's obvious that loading files from that folder is not possible. Installing cURL won't resolve this
@NicoHaase in MY case it did resolve that. Missing extensions on PHP can be a problem as composer is writen in PHP and uses cURL for retrieving the package. Rather than just downvoting, please try removing your curl extension, install laravel, try to run it and check if you get the same message or not. That would be more productive.
Composer will run fine without cURL, and there's no indication in the OP's question that running composer install caused any trouble
@NicoHaase Ok, so according to you, composer comes will all packages available for PHP, with the latest updates. Maybe you should reflect a little bit about it.
Please add all clarification to your answer by editing it. What should I reflect about, and how does this affect your answer?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.