Laravel with error in Composer install

Asked

Viewed 1,114 times

0

I moved the Laravel to the homologation server and when I ran the Composer install, I had this problem. Has anyone ever had anything like this? on my machine that rotates under the flat wheel Vagrant.

The environment is Laravel 5.4, Redhat 7 and php 7

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize
PHP Warning:  Uncaught ErrorException: require(/var/www/html/gemeos-backend/vendor/rachidlaasri/laravel-installer/src/Providers/../routes/web.php): failed to open stream: No such file or directory in /var/www/html/gemeos-backend/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php:71
Stack trace:
#0 /var/www/html/gemeos-backend/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php(71): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'require(/var/ww...', '/var/www/html/g...', 71, Array)
#1 /var/www/html/gemeos-backend/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php(71): require()
#2 /var/www/html/gemeos-backend/vendor/rachidlaasri/laravel-installer/src/Providers/LaravelInstallerServiceProvider.php(27): Illuminate\Support\ServiceProvider->loadRoutesFrom('/var/www/html/g...')
#3 /var/www/html/gemeos-backend/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(574): RachidLaasri\LaravelInstaller\Providers\LaravelInstallerServiceProvider->register( in /var/www/html/gemeos-backend/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php on line 71
PHP Fatal error:  Illuminate\Support\ServiceProvider::loadRoutesFrom(): Failed opening required '/var/www/html/gemeos-backend/vendor/rachidlaasri/laravel-installer/src/Providers/../routes/web.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/gemeos-backend/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php on line 71


  [Symfony\Component\Debug\Exception\FatalErrorException]
  Illuminate\Support\ServiceProvider::loadRoutesFrom(): Failed opening requir
  ed '/var/www/html/gemeos-backend/vendor/rachidlaasri/laravel-installer/src/
  Providers/../routes/web.php' (include_path='.:/usr/share/pear:/usr/share/ph
  p')


Script php artisan optimize handling the post-install-cmd event returned with error code 255
  • The briefcase /var/www/html/ have write permission and this associated with your main user? By chance you are not running on root something right? Because Composer should not run on root, if you did something previously with root, you may have created folders without permission.

  • the /html folder is root:root but the project folder is with my user

  • But you have not previously run any other commands accidentally with su/sudo?

  • The only command I ran was this: sudo chown -R Danilo.dorgam gemeos-backend/ to pull root from folder and daughters

  • Danilo which command did you use to install? Was composer global require "laravel/installer" and then the laravel new blog?

  • on my pc yes, on this server he got from github by sending by Jenkins

  • Danilo may be something that is outdated and Composer is mixing some version stuff, try to follow the steps of the answer.

Show 2 more comments

1 answer

1

There are two ways to install Laravel, the first and perhaps most common is to install the "Laravel/installer", first run the command in any folder, it does not need to be where you will create the project:

composer global require "laravel/installer"

This will install "globally", so the installer will allow you to use, of course Composer needs to be installed globally as well, for that you will have to add $HOME/.composer/vendor/bin at the $PATH of the operating system.

After making sure everything is global, run navigate to the Apache folder and try to create a new project:

cd /var/www/html
laravel new gemeos-backend2

See if the problem still occurs.

The alternative way, without the commando laravel is to install via create-project from Composer, navigate to the folder and execute the command:

cd /var/www/html
composer create-project --prefer-dist laravel/laravel gemeos-backend3

Solving possible problems

For the error message:

Uncaught Errorexception: require(/var/www/html/gemeos-backend/vendor/rachidlaasri/Laravel-installer/src/Providers/../Routes/web.php): failed to open stream: No such file or directory in /var/www/html/gemeos-backend/vendor/Laravel/framework/src/Illuminate/Support/Serviceprovider.php:71

I assume something or has been downloaded in the wrong version or mixed, first we must ensure that everything is up to date, to update the command run:

composer self-update

If not global, turn:

php composer.phar self-update

If you are using Laravel/Installer then remove it first:

composer global remove laravel/installer

And then try to install it again and create a project:

composer global require "laravel/installer"
cd /var/www/html
laravel new gemeos-backend4

Note: changed the folder name (gemeos-backend2, gemeos-backend3 and gemeos-backend4) for each test done, should it be a user/permission problem

Note: the laravel/installer will install the version 5.5 of Laravel

  • I noticed this difference in version, on my pc is 1.4.2 and on the server 1.5.1 will be that a downgrade is a good?

  • @Danilo depends if it is conflicting with another lib, framework, check your Composer.json. A note, both the Laravel 5.1, when 5.2, 5.3 and 5.4 not yet maintained and can be used, the release of the 5.5 does not prevent the use of previous versions.

  • my Laravel is 5.4, however I think it is not it, I installed the lib directly on the server but gave in same

  • @Danilo all above prompted suggestions Uncaught ErrorException: require(/var/www/html/gemeos-backend/vendor/rachidlaasri/laravel-installer/src/Providers/../routes/web.php)?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.