Class 'PragmaRX\Tracker\Vendor\Laravel\ServiceProvider' not found - php

I had installed PragmaRx\Tracker package several months ago into my project.
I started to deleting the package from laravel project through following steps:
1. composer remove vendor/PragmaRx/Tracker
2. remove package name form composer.json file
3. removing package from provider and aliases list in config/app.php file
4. composer dump-autoload
5. composer update
6. also php artisan dump-autoload
I also tried a bunch of other ways to remove the package.
after removing the package I'm getting this error when I run any artisan command (even "php artisan serve" command):
In ProviderRepository.php line 208:
Class 'PragmaRX\Tracker\Vendor\Laravel\ServiceProvider' not found
It's obvious that the package and its related files have been removed! but I couldn't find out the error's reason.
my laravel version is 5.5.4 .
any idea?

finally I found the error's reason.It's because of laravel cache!!
in one hand I couldn't run any artisan command including "php artisan config:cache" to clear laravel cache, in the other hand the cache was the error's reason.So at first I re-installed the pachage :
composer require PragmaRx/Tracker
then :
php artisan config:cache
and finally :
composer remove PragmaRx/Tracker
Done.

Related

Laravel Telescope Failed to open stream: no such file or directory TelescopeServiceProvider.php

I am trying to use the Telescope package from Laravels official documentation and I followed the first 2 steps:
composer require laravel/telescope
and
php artisan telescope:install
Everything went fine in my command line untill the install. I got the error:
ErrorException : file_get_contents(path\app\Providers/TelescopeServiceProvider.php: failed to open stream: No such file or directory at: vendor\laravel\telescope\src\Console\InstallCommand.php
So, of course, I googled the issue and found this and I checked to see if my provider's folder exists. It does and indeed the TelescopeServiceProvider.php is not there. I tried to run the command php artisan telescope:install again and it provided me the message:
Telescope scaffolding installed successfully.
which I thought was strange but ok, I went to the next step of the documentation:
After installing the Telescope, you should also run the migrate command:
php artisan migrate
So I ran that command and I got the message:
Nothing to migrate.
So obviously this didn't go right. I checked after the "fake" installed successfully message if the TelescopeServiceProvider exists now but it still didn't.
What did I do wrong and how do I fix this issue?
Try update Telescope,
composer update --prefer-source
Try removing Telescope and then reinstalling the package as the installation seems to have broken the package:
composer remove laravel/telescope
composer require laravel/telescope
Try:
composer dump-autoload
or:
artisan cache:clear
after you update or make changes to composer.json to refresh everything.
Per
the Telescope Github Issues
Telescope is not ready for Laravel 6 yet. Many people are having this same issue. The solution is to look at this issue.
Although it is a workaround, not a solution.
use composer dump-autoload
and:
artisan cache:clear
but
install composer require brick/math
its work

Issues using php artisan on a laravel 5.7.* app

I've been trying to work on a laravel app but I can't even make it start.
I've run composer install, composer global update, composer udpate, composer self-update and several other commands,
I've deleted the vendor folder, the composer.lock file, re-ran composer install and things I've found online to no avail. This is the error I keep getting:
#php artisan package:discover
In Container.php line 779:
Class request does not exist
Script #php artisan package:discover handling the post-autoload-dump event returned with error code 1
Not sure where to go next. Any ideas?
I would suggest you remove your composer itself and re-install the composer. the try install you laravel packages with it.
Try clearing application cache using this command: php artisan cache:clear
The cache:clear command can be used to clear the applications cache files.
Don't worry about your laravel
check composer correctly installed on your system
check composer have access for READ and WRITE in your system
after your sure about things
check your laravel install in your system for PHP you have and find specific you php version composer connected to it (Those who have multi PHP)
then have two option:
composer global require laravel/installer
then laravel new blog or
composer create-project --prefer-dist laravel/laravel blog
then go to folder cd /projectName
Use PHP's built-in development server: php artisan serve

Laravel 5.5 - Issues creating new project

I'm trying to use Laravel 5.5. I updated my php 7.0 to php 7.1. Even, I update my laravel installer package. But, when I try to do:
laravel new myProject
I get this error:
You made a reference to a non-existent script #php -r
"file_exists('.env') || copy('.env.example', '.env');" You made a
reference to a non-existent script #php artisan key:generate
Illuminate\Foundation\ComposerScripts::postAutoloadDump You made a
reference to a non-existent script #php artisan package:discover
I am using laravel valet and if I go to the browser, when I try myProject.dev is not working. I see this error:
Whoops, looks like something went wrong.
I tried using:
php artisan key:generate
inside my project, but I got that:
[ErrorException]
file_get_contents(/Users/jorgeJimenez/Sites/laravel5-5/.env): failed
to ope n stream
: No such file or directory
I noticed, my laravel 5.4 projects are working. I copied a .env file and I put on my laravel 5.5 projects. After that, I run
php artisan key:generate
and the key was generated and my project in the browser works.
It's supposed, all that process is automatic, but I am not quite sure what is happening.
You can try update your composer:
composer self-update
I had the same problem. Then I found that there was no problem when i created the first project use laravel 5.5. so I clear composer's cache dir. It works well now.
This is because of your Laravel Installer or Composer version. I have faced the same problem and found following 2 different solutions:
Generally you can solve with by running composer global update command and then run composer update command from your project directory. This solution basically updates your installer and then your project.
If still, you have this issue, you need to run composer self-update command first and then run composer update command from your project directory. Here your composer will update and then your project.
Hope this answer will help you.

Fatal error: Class 'LaravelLocalization' not found after composer install in production

It's been 3 days since I'm working on translating my site, so I installed LaravelLocalization:
I did everything working in local, then I pushed it in production and executed:
composer install --no-interaction --no-dev
php artisan clear-compiled
php artisan optimize
composer dump-autoload -o
php artisan route:cache
php artisan config:cache
Now, all the "php artisan commands fail with:"
[Symfony\Component\Debug\Exception\FatalThrowableError]
Fatal error: Class 'LaravelLocalization' not found
In this case, in the composer install script, it fails in:
php artisan clear-compiled
I tried to run:
php artisan cache:clear
php artisan route:clear
But without any results...
Any ideas??? This is not the first time I get this kind of stuff, but I may say that this it's a pain in the ass :(
EDIT:
In my routes.php,
I deleted this line:
Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['localeSessionRedirect', 'localizationRedirect']],
around all my routes, and now composer install works.
But it doesn't solve my issue, because as soon as I put it back, I still get the same error :(
I resolved it removing the line:
Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['localeSessionRedirect', 'localizationRedirect']],
in my file routes.php
run again
composer install
and finally
php artisan config:clear
php artisan route:clear
What I don't know is why it happened, and if there is a way to prevent it...
as what the error says, it means that the composer can't locate your package. so be sure to
check your config/app.php file
be sure to put the package in providers and aliases arrays, respectively.
This has been a known issue for a while, but has actually finally been resolved recently. You can read about the issue here.
Basically, running php artisan loads the entire framework, including the cached files. Since the cached files don't have your service provider, you get the error. This includes running php artisan clear-compiled. So, it is using the cached files in the command that is used to delete the cached files.
This issue has finally been resolved as of laravel/framework:v5.2.25 and laravel/laravel:v5.2.27, and backported to laravel/framework:v5.1.33 and laravel/laravel:v5.1.33.
This fix includes a change to the Laravel application (laravel/laravel), in addition to the Laravel Framework (laravel/framework). To implement, you will need to:
1) Update the scripts section of your composer.json file to match that in the laravel/laravel package. Specifically:
remove the pre-update-cmd section
in the post-install-cmd section, replace "php artisan clear-compiled" with "Illuminate\\Foundation\\ComposerScripts::postInstall"
in the post-update-cmd section, replace "php artisan clear-compiled" with "Illuminate\\Foundation\\ComposerScripts::postUpdate"
2) Once you have updated your composer.json, run a composer update. If you only want to update the framework, you can run composer update laravel/framework.

Class 'Jenssegers\Mongodb\MongodbServiceProvider' not found

I want to use https://github.com/jenssegers/laravel-mongodb for connecting to Mongodb with laravel 5, i have installed MongoDB php driver and then laravel-mongodb with command composer require jenssegers/mongodb, then added service provider in app/config/app.php:
'Jenssegers\Mongodb\MongodbServiceProvider',
and refreshed my website, unfortunately i got error ->
FatalErrorException in compiled.php line 6466:
Class 'Jenssegers\Mongodb\MongodbServiceProvider' not found
how can i fix it?
run composer dump-autoload or php artisan optimize
I didn't have the archive:
myproject/vendor/jenssegers.
I installed this archive by command:
$ composer require jenssegers/mongodb
Delete Following Files and Use This Step :
composer.lock
bootstrap/cache/config.php
if exist
bootstrap/cache/services.php
then Run this command :
composer install
php artisan config:cache
If the previously mentioned solutions won't do the trick, it is possible that some dependencies are missing. Simply try:
$ composer install

Categories