If you have activated SharePoint Server Publishing Infrastructure (Site Settings > Site Collection Features) and SharePoint Server Publishing (Site Settings > Manage Site Features) and are still getting this SharePoint error -
Here is what you could try to fix the problem.
This happened to me when I tried to enable Structural Navigation and Show subsites in Site Settings > Navigation.
Go to SharePoint Admin Center > Settings to enable the Custom Script feature:
Once you've done this it may take up to 24 hours for the error to disappear.
Share