Laravel Artisan not working at all after clone - laravel

I have this weird situation: I've cloned all my repositories from github in a new local machine running Mac OsX some of them has Laravel framework installed but only some of these can execute the cmd php artisan.
I've tried to check permission on folders, uninstall/re-install composer and I've also tried to install a fresh version of Laravel. Another problem is that running the command doesn't output anything - no errors, nothing - only a new empty line of the terminal.
The only thing I know is that if I clone one of the repositories, then run composer install it throws Script php artisan optimize handling the post-install-cmd event returned with error code 255.
Thanks
Update 1:
I've found running composer install -vvv -o that composer throw this error
Warning: require(/Users/USERNAME/laravel/bootstrap/autoload.php): failed to open stream: No such file or directory in /Users/USERNAME/laravel/artisan on line 16
Fatal error: require(): Failed opening required '/Users/USERNAME/laravel/bootstrap/autoload.php' (include_path='.:') in /Users/USERNAME/laravel/artisan on line 16
Update 2:
It seems that cmd git clone didn't copy that autoload file bootstrap/autoload.php for some reason that I don't understand at all.
I've imported the file manually from github and run, removed the vendor folder then run again composer install --no-scripts but still having the problem with artisan and if I run composer update it throw Script php artisan optimize handling the post-update-cmd event returned with error code 255

I had to re-install laravel and copy files manually to make it works again.

Related

Composer update or install issue

I have an web application which successfully run since august 2020. now i want to add milon barcode package and it successfully ok in local server that's why i need to run coposer install or update command in cpanel terminal. but there show some problem.
N.B Laravel version 5.8, composer version 2.0.6, php version 7.4.
when i try to run composer install it show error
PHP Fatal error: Uncaught ErrorException: proc_open(): unable to create pipe Too many open files in phar:///opt/cpanel/composer/bin/composer/vendor/symfony/console/Application.php:952
when try to run composer update
Failed to download phpoption/phpoption from dist: getaddrinfo() thread failed to start
when try to run composer self-update
[Composer\Downloader\FilesystemException]
Filesystem exception:
Composer update failed: "/opt/cpanel/composer/bin/composer" could not be written.
rename(/opt/cpanel/composer/bin/composer): failed to open stream: Permission denied
You need to enable proc_open
Please Follow the Instruction Below in cPanel
Software > MultiPHP INI Editor > Editor Mode
Select your PHP version and search for (disable_functions)
disable_functions = "proc_open,..., ..."
Now remove (proc_open) from the list and save.
Otherwise, contact your hosting service provider to enable proc_open.
try using this command
composer update --no-scripts

Homestead 9 fresh box creating a new Laravel project composer Could not scan for classes inside /vendor/phpunit/php-code-coverage/src/

I am trying to set up Homestead as a development environment and am not having much luck. I follow the instructions to get Homestead up and running on https://laravel.com/docs/5.8/homestead#installation-and-setup. The box comes up fine and I can shell in with vagrant ssh. In the code directory which is mapped correctly to a directory on my Windows machine I create a new laravel project with laravel new example and I get the following error
[RuntimeException]
Could not scan for classes inside "/home/vagrant/code/example/vendor/phpunit/php-code-coverage/src/" which does not appear to be a file nor a folder
I have tried composer update rm -rf vendor && composer install and get the same error. When I use composer install --prefer-source I don't have the install error, but get
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
and
In LoadConfiguration.php line 68:
Unable to load the "app" configuration file.
I have checked that I have a .env file and I have checked that the app file name and path is in lowercase.
Any suggestions would be welcome.
Update VirtualBox to v6.
See this issue on GitHub: https://github.com/laravel/homestead/issues/1219

deploying laravel into Nginx getting error "failed to open stream: No such file or directory"

I have a problem with deploying laravel into my Nginx. I deployed my laravel app thru github.com
but when I execute php artisan config:cache or php artisan make:auth
This is the error I get:
PHP Warning:
require(/var/www/gafsolutions.com/html/laravel/vendor/autoload.php):
failed to open stream: No such file or directory in
/var/www/gafsolutions.com/html/laravel/artisan on line 18 PHP Fatal
error: require(): Failed opening required
'/var/www/gafsolutions.com/html/laravel/vendor/autoload.php'
(include_path='.:/usr/share/php') in
/var/www/gafsolutions.com/html/laravel/artisan on line 18
First, make sure you have set up a composer properly composer install It will just install all the dependencies as specified in the composer.lock file
If you have already installed then run this command:composer dump-autoload It will clean up all compiled files and their paths.
After, run this command: composer update --no-scripts It will Skips execution of scripts defined in composer.json file.
Then run this command: composer update It will update your depencencies as they are specified in composer.json

how to fix error laravel 5.2 "failed to open stream: No such file or directory" without composer

I've got this error in my laravel 5.2 project who hosted in debian linux
Warning: require_once(/home/u706561288/public_html/sap/vendor/composer/autoload_real.php): failed to open stream: No such file or directory in
/home/u706561288/public_html/sap/vendor/autoload.php on line 5
Fatal error: require_once(): Failed opening required '/home/u706561288/public_html/sap/vendor/composer/autoload_real.php' (include_path='.:/opt/alt/php70/usr/share/pear') in
/home/u706561288/public_html/sap/vendor/autoload.php on line 5
so many forum like stackoverflow tell me to using php artisan "composer update" but
unfortunately my hosting package not available to composer instalation
please tell me how to fix this problem
I suggest that you test these steps
On the Localhost, run these two commands (composer update and composer dump-autoload)
Re-upload the entire project on the server
Also, if the problem is not resolved, you can delete the ‍Vendor folder and the composer.lock file and run the composer install command and Re-upload the entire project again.
When the hosting service or some PC does not allow to install Composer and appears error like in my case, follow these steps:
Delete all laravel project in hosting service. I recommend to use smartftp for good speed file access and tracked action.
Back to our localhost project and run composer install --no-scripts command and then composer clearcache.
Reupload all laravel project.
Don't forget to configure .env file.
I hope this can help with the same problem in future.
I had the same error while back, what I did to solve it was. I delete all the vendor folder from the root project then install it back by executing composer install
delete the ‍Vendor folder and the composer.lock file and run the composer install command and Re-upload the entire project again
this helped me
If anyone still facing the issue after deleting the vendor directory and did composer install try to update your composer by composer selfupdate then do the same install process.

How to solve php artisan key generate error?

I created a new Laravel 5.5 project with this command:
laravel new crud-angular
After then, run this command inside the project folder:
php artisan key:generate
At that moment, I got such error:
Warning: require(F:\Study\Laravel\crud-angular/vendor/autoload.php):
failed to open stream: No such file or directory in
F:\Study\Laravel\crud-angular\artisan on line 18
Fatal error: require(): Failed opening required
'F:\Study\Laravel\crud-angular/vendor/autoload.php'
(include_path='.;C:\php\pear') in
F:\Study\Laravel\crud-angular\artisan on line 18
I used wampserver 3.0.6 for this project.
Hope to help me.
Thanks
Make sure you have run:
composer install
Now it seems packages are not installed. If they are, try running:
composer dump-autoload
Try to to give permission for that vendor folder
sudo chmod -R 777 vendor
update your composer also
composer update
this will fix your issue
Most likely you forgot to Install composer just run composer install

Resources