Remove package from laravel-6.2 existing project an error occurred

Remove pragmarx/tracker package from laravel project by the following composer command

composer remove pragmarx/tracker

It’s remove successfully but the below error shown. Even though composer update the error not fix.

Target class [PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker] does not exist. 

How can I fix this error ? and which method to follow to completely remove any unused packages from laravel?

>Solution :

From the documentation on the repo:


Require the tracker package by executing the following command in your command line:

composer require pragmarx/tracker

Add the service provider to your app/config/app.php:


Add the alias to the facade on your app/config/app.php:

'Tracker' => 'PragmaRX\Tracker\Vendor\Laravel\Facade',

Publish tracker configuration:

Laravel 4

php artisan config:publish pragmarx/tracker

Laravel 5

php artisan vendor:publish --provider="PragmaRX\Tracker\Vendor\Laravel\ServiceProvider"

Enable the Middleware (Laravel 5)

Open the newly published config file found at app/config/tracker.php and enable use_middleware:

'use_middleware' => true,

Add the Middleware to Laravel Kernel (Laravel 5)

Open the file app/Http/Kernel.php and add the following to your web middlewares:


If you removed the package, make sure to

  1. delete the config/tracker.php file
  2. remove the line PragmaRX\Tracker\Vendor\Laravel\ServiceProvider::class from config/app.php
  3. remove the line 'Tracker' => 'PragmaRX\Tracker\Vendor\Laravel\Facade', from config/app.php
  4. remove the line \PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker::class, from app/Http/Kernel.php

Leave a Reply