Fix for error mesasage "VM Exception while processing transaction: invalid opcode" while migrating contract.
-
Close Ganache if you are using that.
-
Open a second terminal and run $ ganache-cli
-
Make sure to have both terminals open, one with ganache-cli and the other where you make the migration.
-
Run $ truffle migrate in the second terminal.
Done!