How to uninstall Laravel Nova

Marketing screenshot for the initial launch version of Laravel Nova

Laravel Nova is a paid product, and a separate license is needed for each project. So if you install Nova onto a second project to play around with it during the RAD / early building stage, but decide that you actually want to remove it from the application before pushing to production, it might not be immediately obvious how to uninstall it. Let me help you out there!

Uninstalling Laravel Nova - The Bare Minimum

There are a few main steps we need to follow if we just want to disable Nova, but keep most of our configuration in place. Follow these steps first, and then move onto the next section if you also want to remove all of the other files located around your Laravel project.

You'll want to start by removing Nova from the composer.json file:

composer remove laravel/nova

Next, comment out or delete the entire NovaServiceProvider class, otherwise you'll receive errors when updating composer like the following:

PHP Fatal error: Class 'Laravel\Nova\NovaApplicationServiceProvider' not found in /app/Providers/NovaServiceProvider.php on line 10

You can find that file here:

  • app/Providers/NovaServiceProvider.php

If you're using version control (e.g. Git, Subversion) it should be safe to completely delete the file, as the contents will be stored in a previous commit and is therefore easily accessible if you decide to re-enable Nova at a later date. But commenting out the file would also work.

Remove the NovaServiceProvider from the application config file (config/app.php), where you see this:

  • App\Providers\NovaServiceProvider::class

It should be safe to update composer now:

composer update

You will also want to remove any references in your front-end application to Nova.

For example, if you're using Laravel Spark you may have added Nova to your developer menu alongside the Kiosk menu item (resources/views/vendor/spark/nav/developer.blade.php).

Uninstalling Laravel Nova - Deleting Configuration Files

If you have no intention of ever installing Nova onto your project again, or you're mostly using the default configuration and therefore aren't going to lose much, you may decide that you want to clean out Nova completely. At least that way, you'll have a nice clean project without any references to it.

Make sure you've completed the section above before starting this section.

Delete your NovaServiceProvider (in case you only commented it out in the first step):

  • app/Providers/NovaServiceProvider.php

Delete your Nova resource folder:

  • app/Nova/

Delete the configuration file that was generated at install:

  • config/nova.php

Clean up the Nova-generated resource files (CSS / JavaScript):

  • public/vendor/nova/

... and, that should be all you need. Did I miss something? Send me a quick message over on Twitter and I'll be happy to update the post.

Have an excellent end to 2018, and if you're on holidays, have a good one!


Published on 23 December 2018 (5 years ago)
PHP
Laravel