package:discover error code 255 after pulling repo and composer update - composer-php

I pulled a repo with a Laravel app and tried
composer update
but it exits with
Script #php artisan package:discover handling the post-autoload-dump event returned with error code 255
I found the following and regenerated the .env file and the key:
Script #php artisan package:discover handling the post-autoload-dump event returned with error code 255
It did not help anything. I also got the original .env file from the server which also did not help.
Any idea what the problem could be?

ok now it works. What I did:
1.Created a fresh project with
laravel new test
2.Copied the composer.json from the not working project to my fresh project
3.did run:
composer update
(which did not have any problems in that fresh project, who knows why..)
4.did overwrite the vendor folder inside the not working project with the vendor folder from the fresh project after running composer update (see 3.)
5.did run:
php artisan key:generate
6.did run:
php artisan serve
7.app is running without any errors.

Related

laravel telescope nothing to migrate

i have a laravel 6 app that i want to install the telescope in that i did all the commands like composer update and composer dump-autoload and then i install the telescope every thing is going fine and when i run php artisan telescope:install i get the message below :
Publishing Telescope Service Provider...
Publishing Telescope Assets...
Publishing Telescope Configuration...
Telescope scaffolding installed successfully.
but it wont generate the config file and migration so when i run php artisan migrate i get this message :
nothing to migrate
in your command
php artisan vendor:publish --tag=telescope-migrations
then edit you your env file
TELESCOPE_ENABLED=true
after this run
php artisan optimize
Finally
php artisan migrate
You must publish it first using the below command:
php artisan vendor:publish --tag=telescope-migrations
Then you will get the default migrations and also the config/telescope.php file
After installing the telescope in my project and exporting the default migration I got this error.
λ php artisan vendor:publish --tag=telescope-migrations
Unable to locate publishable resources.
Publishing complete.
How I solve this issue
If you're getting this issue open telescope.php file which is inside of your config directory.
and then set the value of this TELESCOPE_ENABLED to true
'enabled' => env('TELESCOPE_ENABLED', true),
Because in my case the value of TELESCOPE_ENABLED this was false
Then again run this command php artisan vendor:publish --tag=telescope-migrations.
I hope it will work :)
I had accidentally ran php artisan optimize in my local environment which was causing this issue. To fix it, I had to run php artisan optimize:clear, then uninstall laravel/telescope, remove any references to it, and install it again from scratch. It then recognised the migrations and the published assets.
I did this
composer remove laravel/telescope
Then change your .env file
TELESCOPE_ENABLED=true
Then install back again it worked!

Laravel throws Facade root error on key:generate in pipeline

I just tried to push a commit on a project. When this happens, my GitLab CI picks it up and tries to install the projects dependencies via Composer in it's Docker container. After installing the dependencies, it'll copy the .env.example file to .env and run php artisan key:generate
However, when it does this, my pipeline crashes on the following:
$ php artisan key:generate
In Facade.php line 258:
A facade root has not been set.
I've tried to set the key locally in various ways, removed composer depenencies and reinstalled them, but in none of those scenarios, I encounter this error in my local environment.
Is this a known bug in Laravel? (6.18.0)
Thanks.

problem with laravel when run composer install

i have a laravel project on my github. and i recently cloned to my pc but for some reason i got this error:
Generating optimized autoload files
Illuminate\Foundation\ComposerScripts::postAutoloadDump
#php artisan package:discover
In Compiler.php line 36:
Please provide a valid cache path.
Script #php artisan package:discover handling the post-autoload-dump event
returned with error code 1
I created cache, sessions and framework folder inside storage folder but it does not work.
I also tried many things I read on forums and here on stack but nothing works with me.
i really don't know what's happening.
At first run: composer update
Create these folders under storage/framework:
sessions
views
cache
and run this below commands:
php artisan cache:clear
php artisan config:clear
php artisan view:clear

Composer having trouble with installing fresh laravel libraries

I'm installing a new Laravel 5.6 ambient with composer, but every time i do a "Laravel new projectName", when i run composer install or composer update, it returns this error:
Could not scan for classes inside
"path/to/vendor/hamcrest/hamcrest-php/hamcrest" which does not appear
to be a file nor a folder
After hours of trying to fix it, I made a test, manually creating the hamcrest folder. When i ran composer install again, it pointed that composer couldn't read a file in the "psysh" library, when i went to check it, the folder was completely empty. I downloaded the files again and put them in the folder, just to test if it was going to run. After doing that and running composer install, this error popped out
Illuminate\Foundation\ComposerScripts::postAutoloadDump #php artisan
package:discover
In ProviderRepository.php line 208:
Class 'Laravel\Tinker\TinkerServiceProvider' not found
Script #php artisan package:discover handling the post-autoload-dump
event returned with error code 1
I don't know where i messed up, since this is a fresh install of composer + laravel. I ran composer diagnose, but everything is ok. Does anyone where is my error?
Laravel Tinker
composer require laravel/tinker
Once the package has been installed, you should add Laravel\Tinker\TinkerServiceProvider::class to the providers array in your config/app.php configuration file.
then in console, make a
composer dump-autoload

Error removing UniSharp laravel-ckeditor with composer

I installed laravel-ckeditor via composer in my Laravel 5.5 project as described on their GitHub (https://github.com/UniSharp/laravel-ckeditor). Now i don't need it anymore and want to remove it. I executed composer remove unisharp/laravel-ckeditor but i get this error messge:
In ProviderRepository.php line 208:
Class 'Unisharp\Ckeditor\ServiceProvider' not found
I have on idea what causes this error. I tried reinstalling and removing it several times, but i always get the same error message.Thanks for any help.
Edit: The error is caused by artisan. I can't execute php artisan cache:clear anymore and directly before the error, composer prints
> #php artisan package:discover
into the console.

Resources