I clone the repository on local and try to run the installation command, but its just throwing an error that

In WebsiteRepository.php line 159:
The default website isn't defined. Set the website and try again.

I delete .env, roll back my composer to 1.9.0 nothing worked yet. I am not sure what causing the issue, try to check the logs but it not showing anything much, I added a screenshot hope that can help something. enter image description here

4 Answers 4


Most probably you have env.php still presented in your project.

Just delete env.php file and then try again.


Firstly try with rm -rf dev/tests/integration/tmp/sandbox* inside the project directory. Then if that does not work have a look at the steps below:

  • Debug into \Magento\Store\Model\WebsiteRepository::getDefault, where the actual exception is thrown.
  • The first call of \Magento\Framework\ObjectManager\ObjectManager::get shows which CLI command leads to the issue.
  • The next call of \Magento\Framework\ObjectManager\ObjectManager::get shows which dependency of this command leads to the issue.

I'm probably late to the party, but I've managed to deal with this issue by running the following command.

php bin/magento setup:uninstall

This will remove any existing config files including env.php from the previous installation, properly uninstalling Magento and this will allow you to go through the installation process without issues.

I assume this error occurred, at least in my case, because Magento has been previously installed and configured in some way and your local configuration does not match the already existing one. It's basically looking for a shop that you are yet to create.

Hope this helps someone :)


I tried everything as suggested but the issue still remains, after that I remove/disabled all the third-party modules and tried again and now it worked fine, after installation, I enable/install modules again.

hope this might help someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.