There are 3 Magento 2 modes of operation that your system will be running on: developer, product and default mode. This setting is configured in your app/etc/env.php file, which is the value of ‘MAGE_MODE’ key.
Now we should know what each of the three Magento 2 modes does to your system. The developer mode, which is the mode you will be using most of the time, will display all exceptions, undefined variables, …
Running on developer mode, your system will also turn on code generation, which is needed for the system’s object system. Front-end files such as js, css and template files generation will also be available.
Running your system on developer mode will make your developing extensions on Magento 2 easier for sure. But when the customers want to deploy Magento on their server, they will be using production mode, which will hide MOST of the errors, turn off code generation. When you switch from production to developer mode, you have to clear generated classes and object in var/generation to prevent errors.
Default mode is the combination of the two above, which will suppress error messages but will turn on code generation. We don’t normally use this mode.
To switch Magento 2 modes, either edit the file in app/etc/env.php or use the command:
You might want to clean the cache after that: