This can happen when trying to build a magento site when the DB is not reachable and the config file doesn't have any stores set.
You should be able to run php bin/magento app:config:dump
on a working instance to see what app/etc/config.php
and app/etc/env.php
should look like. The minimum we have got it to is:
app/etc/config.php
<?php
return array(
'modules' =>
array(
...
),
'scopes' =>
array(
'websites' =>
array(
'admin' =>
array(
'website_id' => '0',
'code' => 'admin',
'name' => 'Admin',
'sort_order' => '0',
'default_group_id' => '0',
'is_default' => '0',
),
'uk' =>
array(
'website_id' => '2',
'code' => 'uk',
'name' => 'United Kingdom',
'sort_order' => '2',
'default_group_id' => '2',
'is_default' => '1',
),
),
'groups' =>
array(
0 =>
array(
'group_id' => '0',
'website_id' => '0',
'code' => 'default',
'name' => 'Default',
'root_category_id' => '0',
'default_store_id' => '0',
),
2 =>
array(
'group_id' => '2',
'website_id' => '2',
'code' => 'united_kingdom_group',
'name' => 'United Kingdom',
'root_category_id' => '1838',
'default_store_id' => '2',
),
),
'stores' =>
array(
'admin' =>
array(
'store_id' => '0',
'code' => 'admin',
'website_id' => '0',
'group_id' => '0',
'name' => 'Admin',
'sort_order' => '0',
'is_active' => '1',
),
'uk' =>
array(
'store_id' => '2',
'code' => 'uk',
'website_id' => '2',
'group_id' => '2',
'name' => 'United Kingdom',
'sort_order' => '0',
'is_active' => '1',
),
),
),
);
app/etc/env.php
<?php
return array (
'system' =>
array (
'default' =>
array (
'dev' =>
array (
'js' =>
array (
'minify_files' => '1',
'merge_files' => '0',
'enable_js_bundling' => '0',
),
'css' =>
array (
'merge_css_files' => '0',
'minify_files' => '0',
),
),
),
),
'cache_types' =>
array (
'compiled_config' => 1,
),
);
You will need to update app/etc/config.php
to match your store information, list can be obtained from the db tables:
- store
- store_group
- store_website
Hope this helps