V5 install never completes, just shows setup page over and over

For some reason, I can’t get the setup process to complete. it just keeps loading after completing it. When I inspect the .env file, it was written to with all my values, but going to the top level of my site shows the invoice ninja image and wrapper on the left, and a 500 error on the right.

When I look at the laravel log, all I see is this:

[2021-11-21 09:29:09] production.INFO: SQLSTATE[HY000]: General error: 1005 Can't create table `v5ninja`.`migrations` (errno: 121 "Duplicate key on write or update") (SQL: create table `migrations` (`id` int unsigned not null auto_increment primary key, `migration` varchar(191) not null, `batch` int not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci' engine = InnoDB)  
[2021-11-21 09:29:13] production.INFO: account table not found  

I have checked all configs and can’t find the problem. And the setup page passes all tests without issue. Any suggestions?

Seems like the setup part never actually created the tables in the provided db, even though the connection showed “success”


It may help to run php artisan migrate

Thank you, but at what point in the process? Here are the steps I followed, in order:

  1. create db (v5ninja)
  2. create nginx config with le cert
  3. download zip and unzip
  4. copy .env.example to .env
  5. run https://mydomain/setup

Is it not clear to me at what point and how/where I am supposed to run commands for creating encryption keys, adding Phantom keys, create cronjob, optimize, etc, and now what point I should run this migrate command and what it actually does?

update: I ran the migrate command and saw that it created tables in the db, but still no dice, app will not load. and unfortunately no errors I can find now in any log file (nginx, laravel, etc)

@david any thoughts?

at this point I have tried the following, all unsuccessfully:

  • tried running setup process with completely blank .env file
  • tried setup with only APP_KEY in .env
  • tried manually populating .env file

And after each of the steps above (AND after setup process) ran (or didn’t run) artisan optimize. The app never works, it either gives me the 500 errror noted above, or returns me to setup page as if nothing ever was setup, despite it having written values into the .env file.

One very odd thing I did notice once or twice: if I had a previously created db (because I kept trying to create new DBs as well to troubleshoot this) sometimes the setup would populate tables in the PREVIOUS DB, even though it was NOT the one specified in the setup web page. (probably related to one of the times I did not run optimize command, a cache??)

Some clear ordered instructions would be helpful here, especially as relates to how to properly setup .env file before AND after running /setup web page. It is not at all obvious from the documentation. Thanks for any and all help with this btw, I really appreciate it.

try setting


in your .env file, you should see the actual error appear.

alas, nothing. It still just forwards to the /setup page. Even after optimize and restarting nginx

Finally got it to work after doing two things:

  1. Disabling Diversion in my router (it is like Pi-hole. Is there some kind of advertising end point that must be reached during installation in order for it to work??)
  2. Tried with Firefox (after both Chrome and Safari failed)
1 Like