As well as other answers given, this error can also happen if the migration filename is not a snake-case version of the class name.
So a migration file 2019_01_18_020910_create_roles_table.php must contain the class CreateRolesTable. If it contains the class CreateRoleTable, with a missing s, then the “Cannot declare X…” error is thrown. I’ve found this on Laravel 8, and may apply to earlier versions.
It appears to happen because Laravel loads the migration file multiple times when the filename is misspelled, and the second time loading is when the exception is throw.