Laravel throws Facade root error on key:generate in pipeline - laravel

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.

Related

Deploy laravel from github to heroku gives error" In order to use the Auth::routes() method, please install the laravel/ui package"

I uploaded a laravel app working fine locally on github and deployed on heroku. but I kept Getting this error when deployed on heroku. view Error Image
I tried these cmds on heroku console
composer install
composer require laravel/ui
php artisan ui bootstrap --auth
but when ever I enter "php artisan ui bootstrap --auth" it says artisan not a directory or not found but its there.
I have tried "composer dump-autoload" as well, still same..
pls help
You can't install things interactively on Heroku. At best, it will appear to work temporarily but get reverted within 24 hours. All dependencies must be declared so Heroku can install them at build time.
Run composer require laravel/ui locally, then commit your updated composer.json and composer.lock files and redeploy.

Laravel project pages not showing

I have cloned a laravel project from github and when I try to use it on my localhost, all I see is the homepage, which is fully functional, but has bits of content and images missing. Then if I try to go to any other route I get an error saying The requested URL was not found on this server.
For reference I am using MAMP as the web server, I have checked the httpd file and everything seems okay, anyone got a clue what's going on?
Use these commands in order :
cp .env.example .env
composer install
php artisan key:generate
php artisan migrate:fresh --seed
npm install
npm run dev
php artisan serve

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!

Nothing to publish for tag [Charts_assets]

I installed everything using the steps that they provided.
I ran composer equire consoletvs/charts on the package . This installed into the vendor folder.
I then added the ConsoleTVs\Charts\ChartsServiceProvider::class,into the provider in config/app and 'charts'=>ConsoleTVs\Charts\Charts::class, as an aliases..
I ran artisan vendor:publish --tag=charts_config, the config file created successfully and I had no problems.
I ran php artisan vendor:publish --tag=charts_assets --force
But I kept on getting: Nothing to publish for tag [[charts_assets]]. which has lead me to thinking that this could be the problem since the package is not published.
any solution to solve this problem ?

Downloaded laravel project hangs on preloader when deployed on localhost

I'm trying to deploy a laravel project I have received onto my localhost but it hangs on the loading page and doesn't load the site.
I received the source code of a laravel project that was coded for me.
The deployed website on the shared hosting works properly, and I can also manipulate the files through my ftp access.
However, I'm trying to deploy the project on my localhost (as well as to migrate to a different shared hosting service).
I tried loading the server on wamp, homestead and with artisan serve, but all methods end up the same - the index.php seems to be loading, but is stuck eternally on the preloading .gif file and doesn't present the site.
the browser debugger is throwing a lot of javascript errors (see attached image)
I assume a have a config problem, but I can't locate it and I am unsure how to even locate & debug the issue.
I tried following these configuration steps:
1. changed .htaccess to generic laravel .htaccess (deleted cpanel related lines)
2. changed the .env to fit my wamp db / homestead db
3. composer install
4. composer update
5. php artisan key:generate
6. php artisan cache:clear
7. php artisan migrate
I also installed laravel-debugbar but it hasn't helped me out of the box, and I'm unsure where I need to try to catch the problem.
If anyone can give me pointers on how to understand my problem better, I would be very thankful.
Thanks in advance!
laravel bug
Double check your .env if all details are correct
Set APP_DEBUG=true in your .env file
Double check if your database exist and have data if you are using a database
Check if your host is added to /etc/hosts
Check if your host is added to apache/nginx config correctly
Try running these commands:
$ rm composer.lock package-lock.json
$ composer install
$ npm install
$ npm run dev
$ php artisan clear-compiled
$ php artisan optimize:clear
$ php artisan package:discover
$ php artisan storage:link
$ php artisan migrate:fresh && php artisan db:seed // optional!
Then clear browser cache to be safe.
Open web inspector to see if you can see any errors.
Open latest laravel log in storage/logs/ folder to debug.
If all fails, install laravel-debugbar and see if you can debug there.

Resources